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