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? 0:00 Again, now don't worry if you had some sort of struggle. 0:02 It's totally natural and you are growing and 0:05 honing your skills through that process no matter what you were doing. 0:07 So here's how I did it. 0:10 So I needed to create a string named place, 0:11 and the place I chose is called Kwik E Mart. 0:15 So there we are, there's Kwik E Mart inside of a string literal. 0:18 You can tell because I've got the double quotes there. 0:21 And then I used the read line method. 0:23 So that's off of the console, I used console I used the read line method. 0:27 One thing I want to note here is see this L, it's capitalized, and 0:31 that trips some people up sometimes they forget to capitalize that. 0:34 It is camel-cased, it's read Line, two words, jammed together, camel cased. 0:36 And I left a few spaces on it, too, so that it's all on the same line, right? 0:41 And then finally, we used Print+F to print formatted text, right? 0:45 And these %s's here are the placeholders that line up with firstName and place. 0:53 I'm also using %n here. 0:57 Check the teachers notes on this video for more on that. 1:00 And then we can of course run it right, we can say clear && javac and again 1:05 files called Greeter, I am gonna make sure I say that, don't forget to save. 1:11 And we're going to run it. 1:14 There is my JAVA_TOOL_OPTIONS. 1:23 What is your first name? 1:26 It's Craig. 1:27 Hi, Craig. Welcome to Kwik E Mart. 1:28 Great! 1:29 How do you do? I wanna remind you, keep on practicing and 1:30 make sure you let us know if you'd like to see more of these. 1:33 See you in class real soon. 1:36
You need to sign up for Treehouse in order to download course files.Sign up