download 5 - Here is What You need to know about Writing Your First Java Program
Computers Programming Technology

Here is What You need to know about Writing Your First Java Program

So today you’re gonna be writing your very first java program that displays a simple message on the screen. So just copy the entire code below the way it been written and let explain what it does.

class apples {
public static void main(String args[]){
System.out.println(“Hello world”);

So one thing you should know is that for any program to run, it must have to be in a class and in our example above apples is the name of our class.

A class is just like what holds the entire program just like a house accommodating a family but in this case the methods are like the family under the shelter of the building which is the class.

The second line of code above is simply just a method or rather the main method and that where every program starts from when it run.

The public means that the method could be used or accessed by the public. The static

means it doesn’t necessarily need an instance to run. The void signifies that it doesn’t return anything. And finally the main is just the name of the method.

Dont worry if you don’t understand much of this, we’re just giving you an overview.

If you create multiple classes, without creating the main method your entire code won’t work, the main method is just like the entry point of your code. (You’ll get to know more about the main method in upcoming chapters)

The last line of code is just the syntax java uses to display texts on the screen.

Don’t forget to check out the next tutorial for more on java programming and also don’t hesitate to let us know if you have any complaints, questions or suggestions.

Hello there I'm a tech-inclined geek, and I've always been a huge fan when it comes to anything tech, so I decided to share my knowledge with the online community and also share some of the latest buzzing news in the tech biosphere. i am dedicated to providing you guys with the best news updates. email: [email protected]

Don't forget to leave a Reply