Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialArthur Kharzamanov
5,414 PointsWhy doesn't he need a space in between the string and the variable?
Well, in case I didn't phase that right, here is what I mean. He doesn't need a space between readLine and the following parenthesis or between printf and the following parenthesis. For me until I inserted a space in there, javac command would show errors. For him the code works fine without them.
2 Answers
John Paige
7,436 PointsHello Arthur Kharzamanov.
That issue sounds a little strange. Will you post your code here? I'd like to read it and figure out why that's happening to you.
Arthur Kharzamanov
5,414 PointsNo get it thanks) Sometimes its obvious that a space is necessary it's just this bug through me off a little. Thank you though:)
Arthur Kharzamanov
5,414 PointsArthur Kharzamanov
5,414 PointsActually, now as I tried rewriting the code this issue is no longer there and whether with a space or not the code works fine. I guess it was some bug or misunderstanding. So I assume Java isn't sensitive to spaces? Like are these the same to Java?
John Paige
7,436 PointsJohn Paige
7,436 PointsThat's good you were able to resolve the issue.
My understanding is that sometimes you need spaces, and sometimes not. You definitely need them on the declarations, like if you are declaring 'name' as a string, you wouldn't be able to use 'Stringname'. Java wouldn't understand that as a String declaration. I don't think having spaces before and after the '()' typically hurts anything. I can't think of a good way to explain all the instances of when to/not to use spaces.