Let's create the Hello World java Program.
class basic {..}
In Java, every program begins with a class definition. In the program, basic is the name of the class, and the class definition is:
Code Snippet
class basic
{
......
......
}Note
public static void main(String[] args) { ... }
This is the main method. Every program in Java must contain the main method. The Java compiler starts executing the code from the main method.For now, just remember that the main function is the entry point of your Java application, and it's mandatory in a Java program.The signature of the main method in Java is
Code Snippet
public static void main(String[] args)
{
...
..
...
}This is a basic Java program that prints "Welcome Back" to the console. The public class basic declares a public class namedbasic. The public static void main(String args[]) is the main method which is the entry point for the program. TheSystem.out.println("Welcome Back"); prints the string "Welcome Back" to the console. Overall, this program will print"Welcome Back" to the console when executed.
Source Code
basic.java
// import java.lang.*;
public class basic {
public static void main(String args[]) {
System.out.println("Hello World");
}
}