with so many websites dedicated to advanced programmers it's becoming
harder to learn how to code as a beginner so in this video I'm going to
boost your coding confidence and teach you one of the most important Java
pieces of code system.out.println what's up guys it's Alex welcome to
another Java tutorial for beginners on this channel I do a lot of reviews and I
also do a lot of easy coding tutorials so if you're new here
consider subscribing in the last tutorial we installed Eclipse and we
also wrote our very first Java program to output text to the screen if you
haven't seen the first Java tutorial for beginners I highly recommend you watch
that one before proceeding with this one if you want to check it out I'll have a
link on the screen and also in the description so why did we install
Eclipse and why did we output text to the screen we installed Eclipse because
it has a way to edit our code it lets us run our code and in the future it'll
also tell us what our codes doing and it does it all in one place which is really
nice we learned how to put text to the screen because it's actually a really
easy program to learn and it's also one of the pieces of code you'll use very
often in Java again don't try to memorize it once we play with examples
we'll start to get the hang of it over time and it'll come more naturally so
let's pick up from where we left off open eclipse on your toolbar
mine is on the left the steps will be very similar on windows as well we're
greeted with the welcome screen we can just close that out and I'm realizing
that the text is really small so let's make that actually visible to people
we're going to want to go to preferences then under general appearance colors and
font this basic will be closed open the basic folder and under here click text 1
and then we can edit it so this will let us change the font of our code and also
the size so we can change that from 12 till I 18 and then hit close apply
applying close and now our code is more YouTube friendly if we run this code
with the green arrow in the top left on the bottom window you'll see what the
text output is and it's hello world it's exactly what we have in these double
quotes and when you think about it it's pretty sweet you can't
whatever you want in here um you can type just any sentence save it and then
run it and then it'll come out here but we learned that in the last episode but
today we're gonna explore it a little more so I said we could output anything
and that's true you can output anything so let's try an essay let's write
something really long we wrote something pretty long save it run it and this is
exactly what we expect and this is good but you have to kind of scroll through
it if you want to read the whole thing so what we could do if we have something
really long we want to put on the screen we can break it up so what I'll do is
delete everything inside the quotes and start over then let's just say this is a
sentence if we wanted to move to the next line we can copy it paste it with
command V or ctrl V I'll have the shortcuts down below change that to be
sentence and then save it run it and it goes to the next line so we could do
this like five times copy paste paste paste and then change
it a little bit save run and now we have five lines with five different sentences
so it's not all on the same line we're just making it look a little nicer let's
keep exploring let's see what else we can find
so now I'm gonna have some fun with it I'm gonna make a pattern we'll start
with one symbol and then maybe go to two let me go to three and then go back down
to two and one so one asterisk then two then three then two then one
let's run Oh save it and run and see what happens yep it's exactly what we
expect so with these examples it looks like this line of code outputs whatever
is in the quotes and then goes to the next line so it
actually kind of does two things it puts the text and then goes to the next line
and that's actually what this L n stands for it stands for line so I'm gonna blow
your mind if we remove the line this is actually a new piece of code so it'll
just put the text and never go to the next line so let's see what that does
command s or ctrl s to save run and now look we we put out the first asterisk
then two then three then two and one all in the same line so this is a new piece
of code that still puts text to the screen but doesn't go to the next line
so now you know two pieces of code don't memorize any of it I have notes in the
description so now it looks like we're left with system.out.print and
they call it print because it's like printing words on a piece of paper but
in this case we're printing to the screen so let's just do one more example
let's try to do the alphabet let's do a B and E with this code it should print
out the results ABCDE and never go to the next slide so let's save run and it
does what we expect it to but if we add the line L end to each of these it'll
output what's in the quotes and then go to the next line for each so we have a B
C D so let's save it run it and now we have it with new lines in between the
purpose of this video was to help you get more comfortable with some of the
very first pieces of code you ever learn in Java we can now put text to the
screen with code called system.out.println and also
system.out.print you can pull what everyone the quotes and that exact same thing will
come out on the screen all the notes for this video will be in a link in the
description of this video I hope this was helpful if it was please leave a
like and that'll tell me to make more who could be anywhere in the world here
with me and I appreciate it catch ya