Java for beginners

java for dummies

Deciding to learn Java may seem scary. When learning a technical skill as programming, it’s too easy for authors or instructors to lose themselves into the technical details of some concepts, and making them just so much harder to understand, especially if the course, class or tutorial was aimed for people without any coding background.

Things are much better than they used to be when it comes to learn programming, as many people have been able to learn the skills and become full-time developers without any previous experience in code. But there’re still so many concepts and terms that are quite intimidating, and the Java programming language, which is great and a highly in-demand technology for programmers, suffers from this problem, as it’s a bit of an intimidating programming language. At first.

Learning Java the easy way

Go ahead and download an IDE (Integrated Development Environment) for Java, a great one is IntelliJ IDEA Community; it’s free, modern, and really good overall. Also, download the JDK (Java Development Kit) on its current stable version (JDK 12 right now), and get your development environment ready.

Now, create a new Java project, choose JDK 12, and name it something like HelloWorld, or something meaningful for you. You might also like to follow this naming convention of capitalizing the first letter of each word and not using spaces, LikeThisForExample.

Now, on the project tool window, right click on the src (for source) folder, create a new Java Class, and we’ll give it a curious name: com.example.helloworld.HelloWorld. Eh? What was that?

That’s a convention in java. First com is always there, let’s keep it. Then, example is the name of a company, but, what company, if you are just learning Java? Well, it doesn’t have to be the company, but something quite general that encompasses the whole project.

In this case, example is fine, but you might want to use tetris, for example. Then helloworld is the name of the package, and a package is a collection of classes (don’t worry if you don’t know what a class is just yet).

Following our tetris example, this game would be made out of different functionality, so a package will contain individual code. For instance, you’d want to have a package for gamelogic, and other one for utilities.

Finally, our class will have the same naming convention as before, and in this case, it is HelloWorld. For a class in tetris in the package gamelogic, you might want a class called Matches.

Writing, running and understanding your first program

You have a development environment, a project, and a java Class, and you’ll most likely see something like the following:


package com.example.helloworld;

public class HelloWorld {



It surely looks awesome, with so much syntax coloring, but, what does it mean?

First, our package, exactly how we’ve specified it, only up to the package name, which is helloworld in this case. The name of the class, HelloWorld, is not there because that’s what the third line does. There, we declared a public class with the name HelloWorld.

Public? What does that even mean? And what is a class anyway?

Let’s remember that Java is an Object Oriented language, and it really adheres to the OOP (Object Oriented programming) paradigm. In Java, everything is a class.

That public part, is something called an access modifier, there are to others, protected and private. For our class to be public just means that it will be accessed by other classes. But, honestly, it doesn’t really matter right now. If you skip it, it’ll just be public by default, but let’s get the habit of writing it.

Let’s add some more exciting code:


public class HelloWorld {

public static void main(String[] args) {

System.out.println(“Hello, World!”);




Public, and now also static and void? What are you talking about?

Let’s forget for a moment about the entire public static void part, and focus on main. All Java programs expect to find this thing, a method, with the name main somewhere in the program. Let’s say that main will be where we arrange everything to start the program.

Back to public, just as we learned about public for classes, it also applies to methods. Static is something we shouldn’t worry about for now, and it’s there because the Java compiler needs to see it there.

Void is a return type, or rather, it’s what we use when a function or method doesn’t return anything. We might alternatively use String for text, int for integers, etc. But main being void is necessary.

Now, String[] args. What is that? More requiremenets from the compiler, and you’ll only need that for main. In the future, you could want a method to receive and argument called args of the type String[], but when that time comes, you’ll know it.

What is left to understand is System.out.println, what is that?

What we really care about, is println, as this is the actual function that allows us to display something on the screen. System.out basically indicates the classes where println comes from, and it’s so standard, that by writing sout, you’ll probably get autocompletion.

Finally, (“Hello, World!”). For fun, change what is inside the double quotes, to any message you want to say to the world, or just say hello. Now, run the program, and you’ll have written your first Java program.

Hopefully, Java programming is not intimidating for you anymore. It’s admittedly verbose, but it’s also highly valuable and useful to program in Java, and, by making sure you are understanding the basics, you’ll soon be able to write awesome applications with Java.

Our locations