Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Explore the project
This video doesn't have any notes.
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
[MUSIC]
0:00
Hey hey, first off,
0:04
I wanna say awesome job choosing to
make practice part of your routine.
0:05
Practice is an excellent way to make
sure that what you've been learning
0:10
is sticking.
0:14
Now, this specific practice session is
one of a series that we hope to create
0:15
over time, so please, make sure you
let us know how you liked it and
0:19
if you'd like to see more of these.
0:23
For this session,
I'd like you to practice doing IO.
0:24
Now remember, that stands for
Input and Output.
0:28
Taking input from the user, and
outputting it to the console.
0:30
As long as you've completed Stage
2 of the Java Basics Course,
0:34
you will have the proper skills
to complete this practice.
0:38
Now, I've attached a new workspace to
this video, and it looks like this.
0:41
Now, this is the basic shell
of a Java application.
0:46
And I've gone ahead and
I've imported the console object for you.
0:49
And it's all ready for you to use.
0:53
So in order to do this practice, the idea
0:55
is that you're going to read through
these to-do's here and complete them.
0:57
Now the point of this little
program is to be a greeter to
1:01
someone entering a place of your choosing,
actually.
1:04
You know, like how some stores have
people that greet you when you come in.
1:07
And in fact I have an example project,
I'm not going to show you the code,
1:10
it's hidden underneath here.
1:14
So what's gonna happen, you'll notice
that the file is called Greeter.java.
1:16
So we're gonna compile it, right?
1:19
We're gonna clear the screen,
compile it, and then we're gonna run it.
1:20
So this is what it looks
like when it runs.
1:23
Now, see I get those commands too.
1:25
A lot of people complain in the Java
basics course that they don't see those,
1:27
but here it is.
1:30
I'm getting them too.
1:31
So my first name is Craig.
1:32
And it says, hello Craig!
1:35
Welcome to Kwik E Mart,
cuz Kwik E Mart is what I chose.
1:36
Let's take a look at
those to-dos real quick.
1:38
For this first to do, it says,
create a new string named place and
1:41
assign it a value of your choosing.
1:45
For this example, I chose Kwik E Mart.
1:47
So then I provided you
the console like we talked about.
1:49
And we want to prompt the user
what is your first name and
1:53
store that in a new variable?
1:57
And then finally, we want a print out
to the console, hello first name,
2:00
welcome to the, place that you chose,
all using those variables.
2:03
This might seem like a fairly
simple application, but
2:08
it's great practice in recalling
the syntax and flow of the application.
2:11
If you can't quite get it, don't fret.
2:16
I show how I did it in
the video right after this.
2:18
But please, do give it a try.
2:20
That struggle to remember the syntax and
structure is well worth it.
2:22
That recall will pay off in the long run.
2:27
It's just like muscles.
2:29
No pain, no gain for your brain.
2:30
You got this.
2: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