J2SE- Java Standared Edition. "> J2SE- Java Standared Edition. "/>
Today we are going to learn that, How we can create the simple "Hello World" program in Java [J2SE].
J2SE- Java Standared Edition.
First of all, we have to create a file with any name but must having .java extension. After that we have to open that file in any of the editor to write the code inside the file.
We will write code like this, see above diagram
In the code there are some terminologies,
1-public: Defining that our class is public. Means it can be access easely in othere packages or classes.
2-class: class is a keyword to create the class.
3-New: New is the name of our class, we can write any name for our class.
4-static: static is showing that the main method is not associating with any intance of the class.
5-void: Void is the return type, which shows that It will not return anything or null.
6-main: It is the predefine method, which is called by the JVM (Java Virtual Machine).
7-String args: It is the array of string type. It can have commond line arguments.
8-System: System is predefined class in java.lang packge.
9-out: Out is the static member of the System class.
10-println(): It is the method or function which is used for the print any statement on the screen.
We will use the command to compile and execute the program:
For compile:- javac New.java
For run:- java New
After executing it will return following output.
So this is how the Java Program will be written in simple way.
Still you have any doubts in this program then you can comment below to get the quick answer.
Thanks for reading post.