Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
The Solution1:38 with Craig Dennis
This is how I solved it! How'd you do?
- Can you help us out by filling out this quick survey about this practice workshop?
- You might've noticed I used
%nfor new line, instead of the escape sequence
\n. The reason for this is that Windows and Unix based systems (Like Mac and Linux) use different newline sequences.
%nmakes the proper distinction.
Okay so how'd you do?
Again, now don't worry if you had some sort of struggle.
It's totally natural and you are growing and
honing your skills through that process no matter what you were doing.
So here's how I did it.
So I needed to create a string named place,
and the place I chose is called Kwik E Mart.
So there we are, there's Kwik E Mart inside of a string literal.
You can tell because I've got the double quotes there.
And then I used the read line method.
So that's off of the console, I used console I used the read line method.
One thing I want to note here is see this L, it's capitalized, and
that trips some people up sometimes they forget to capitalize that.
It is camel-cased, it's read Line, two words, jammed together, camel cased.
And I left a few spaces on it, too, so that it's all on the same line, right?
And then finally, we used Print+F to print formatted text, right?
And these %s's here are the placeholders that line up with firstName and place.
I'm also using %n here.
Check the teachers notes on this video for more on that.
And then we can of course run it right, we can say clear && javac and again
files called Greeter, I am gonna make sure I say that, don't forget to save.
And we're going to run it.
There is my JAVA_TOOL_OPTIONS.
What is your first name?
Hi, Craig. Welcome to Kwik E Mart.
How do you do? I wanna remind you, keep on practicing and
make sure you let us know if you'd like to see more of these.
See you in class real soon.
You need to sign up for Treehouse in order to download course files.Sign up