Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Practice Input and Output in Java!
You have completed Practice Input and Output in Java!
Preview
This is how I solved it! How'd you do?
Learn more
- 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.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Okay. So how did you do again?
Don't worry.
0:00
If you had some sort of struggle,
it's totally natural.
0:03
And you're growing and honing your skills
through that process.
0:06
So here's how I did it.
0:10
I needed to create a string name place,
and the place
0:12
I chose is called Kwik E Mart.
0:15
So there we are.
0:19
There's Kwik E Mart
inside of a string literal.
0:20
And then I use the read line
method off of the console object.
0:24
Note that it is CamelCase.
0:29
It’s readLine - two words
jammed together with an uppercase L,
0:31
and I left a few spaces behind it
so the user can type on the same line.
0:37
And then finally we used print
F to print formatted text.
0:43
Right.
0:46
And these S's.
0:48
Here are the placeholders
that line up with our first name
0:49
and place string variables.
0:53
And I added a percent n
to break into a new line.
0:55
And then we can of course run it. Right.
1:00
We can say clear and and Java
1:03
C greeter dot Java.
1:06
And we're going
to run it with Java greeter.
1:10
And here we have it.
1:16
It asks what is your first name.
1:18
It's Laura.
1:20
Hello Laura,
1:22
Welcome to Kwik E Mart. Great.
1:23
How did you do?
1:25
Did you have the same solution
or did you take another approach?
1:26
Keep practicing as practice makes perfect.
1:30
I'll see you in the next one.
1:33
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up