Basic Program in Java


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:

  class basic 
  {
  	......
  	......
  }

For now, just remember that every Java program has a class definition, and the name of the class should match the file name in Java.

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

  public static void main(String[] args) 
  {
  	... 
  	.. 
  	...
  }

System.out.println("Welcome Back");
The code above is a print statement. It prints the text Welcome Back to standard output (your screen). The text inside the quotation marks is called string in java.Notice the print statement is inside the main function, which is inside the class definition

Source Code

//01 Hello World
public class basic {
    public static void main(String args[])
    {
        System.out.println("Welcome Back");
    }
}

Output

Welcome Back
To download raw file Click Here

Basic Programs