1.4 Creating Your First Java Program Part 2
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
Already have an account? Sign In »
4 hours 19 minutes
Now that we have a new project created, you can go ahead and click on this folder here, which is essentially just our project folder with the name that we assigned it
inside of the product folder. We have another folder called SRC, or also known as source or source code.
Now, in this folder, we will have something that we will discuss later on their course called Java Classes.
Go ahead and right. Click on
this folder and
select Java class.
If you are on live, allow a lab guide. Then we are on step number five.
Now, here, in the name you can name your Java class, whatever you would like to name it. But I'm gonna go ahead and name it
Or let's name it. Hello, world,
And I'm gonna click. Okay,
off, Since already, I've already used hello world, and this is taken. So I'm gonna just stick to lab one that you can name it. Whatever you would like to name it, I'm gonna click. Okay,
now what that does is it creates something called a new class for us, which, as I mentioned previously, we will be discussing in the next module
for us and just create a simple program. Today we need two main things. One is a main method. If you
look at stepping number six, it says, add a mean method to your program.
a mean method is just essentially an entry point to your program.
So let's follow what this step is telling us to do over here.
Please ignore this line in between. That says the system don't outdoor print light. For now. Just go ahead and type the public static void Maine
with whatever's in the parameters,
I'm gonna go ahead and type that public
okay and then sue
Once we do that, let's move on to step number seven, it says. Add the following line to print a word or sentence to your program, Consul.
Now let's say we want to print out Hello World for this
specific example. We're going to be typing in this specific line, which tells the program that it wants to print something too.
Now inside we're getting we're gonna be writing the word or sentence that we want to print.
So I'm gonna type hello world in this case.
Once you have done that,
go ahead and click on the source folder on our class name, Right, Click and run the program.
Now, once you run the program, it's gonna start building it. And as you can see here, our consul just popped up and we have our word printed out to the consul. Great.
That is your first program in Java printing something simple to the consul, which is a classic example that people use to get into Java and learn some of the very basic things.
Now, at this moment, you can go ahead and exit Java. Sorry, Exit intelli J. By clicking on the X, I come over here
going back to our
slides and video in this video, lecture or lab, we discussed what a. J. D. K. Is and creating our first Java program.
In the coming video, we are gonna be talking about data types and variables in Java and how we can use data types in variables.
Now, as always, if you have any questions or want to connect with me, you can go ahead and join my lengthen below. And I would be more than happy to answer any of your questions. And I look forward to seeing you in the next video. Thank you very much for