HelloWorld In JAVA

HelloWorld In JAVA 1

In programming language, programmer start a program with Hello World. Every programming language including python , javascript, HTML and so on used Hello world as a beginner basic program.

Like other programming language, in java, programmer starts with hello world. Moreover, Java is a bit complex as compared with other programming language but with lots of practice and dedication, it will be easy. So, here we are going to start our first program in java.

It consists of three primary components:- class definition, the main method and code comments. The given instruction will help you to understand code easily:-

Class:-

The class defines to declare that new class is being defined. Without class, program cannot be execute in java.

HelloWorld In JAVA 2

First line

HelloWorld is the class name which is also known as identifier. The entire definition of class is between curly brace ({ }). First curly braces is known as starting point and second curly brace is known as ending point.

Main method:- Main method is mandatory in java programming.

Public:- JVM can execute method from anywhere.

Static:- Without object main method.

Void:- it is non-return type which doesn’t return value.

Main():- Name configured in JVM

String:- main method accepts a single arguments.

HelloWorld In JAVA 3

second line

Here, Input data should be in between curly brace of main method. We cannot perform a program without main method.

Print:-

It prints the given input. The built-in println( ) method accomplishes output.

HelloWorld In JAVA 4

Third line

The printin() method print the line.

 

Comment:-

It is either multiline or Single line comment.

HelloWorld In JAVA 5

Comment

Output:-

After writing code, JVM compile the program and gives meaningful output.

HelloWorld In JAVA 6

output

Here is the output of the given program.

 

This is the first program in Java. Here, the main thing you need to understand is definition of class, main method and printin() method. Hope you get to know something about HelloWorld.

Leave a Reply

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