Java Programming 101 – Setting up Intellij and Hello World code

By now you should have completed the installation of the Java SDK as well as Intellij IDEA compiler. If you have not you can go ahead and watch one of my older videos where I go over the installation of both
of those software. After installing Intellij, go ahead and launch Intellij. Select create a new project. Here you’ll be given a set of options. For java programming, select
java and for project sdk, if it says no sdk here, select new and go to
the location of the java sdk that you installed earlier and select the file.
Once the file is selected, select next and in the project name designation, since this is our first program I’m going to title it Hello World; Hello_World Since this is the first time you’re
launching Intellij I will go over some basics of Intellij settings. First go
to the view tool bar and select tool windows. After you select project you will see the project window appear as shown.
Once you have the project window you can drag it to ensure how space you need. Next select File and go to settings. Once you have settings open, go to Appearance and you can select the theme
of whatever Intellij style you prefer. I prefer the darcula theme
which is more of a dark background and light font. After you have the theme
selected we can go ahead and start programming our first program. Once you
have the Java folder here shown select the small arrow so that it points
downwards and once it points downwards you are given three different folders or
files. The first folder specifies that this is an Intellij IDEA compiler
program. The second folder is titled src or source. This is the folder that’s
going to contain most of your code. Select the folder; right-click; select new
and select java class. Once java class is selected you’ll be presented with a
prompt that asks you for the name of the class. Since this is your first program we
can go ahead and type in Hello_World. Once you’ve selected ok you’re provided with the
coding environment. This is where you’re going to code public class Hello_World is
a class that is public and is titled Hello_World. Notice the
opening and closing braces. The space in between the opening and closing braces
are part of public class Hello_World. Let’s go ahead and type in our first
method. Our first method is public static void main open and close braces and
between the braces type in String[ ] args. Again since it is a
function or a method we can go ahead and open the braces or parentheses as shown.
The space between the opening and closing parentheses of public static
void main is part of public static void main. Between the space we can go ahead
and type System.out.println which is basically telling the system to
print out a line or this line once you have that typed, select open and close
brackets, select quotations and in between the quotations we can type in
Hello World which will be printed out after we compile and run the program. Do not forget the semicolon. It is very important in Java syntax. Once you have this basic
structure completed, let’s go ahead and compile the program. To compile the
program go ahead click on the arrow next to src. Here you’ll see Hello_World. Select Hello_World, right click, select compile or recompile. Once it finishes compiling, it will say a compilation completed successfully and once it says
that we can go ahead and run the program To run the program, select Hello_World, right click,
and select run Hello_World.main(). And once that is run, you will see an
output and you’ve coded your first Java program – Hello_World

Leave a Reply

Your email address will not be published. Required fields are marked *