Java Introduction

Java programming language is very easy to learn. More than 3 billion devices run Java. Java is used to develop apps for Google’s Android OS, various Desktop Applications, such as media players, antivirus programs, Web Applications, Enterprise Applications (i.e. banking), and many more!

The main Method

the main method must be identical to this signature:

public static void main(String[ ] args)

Here,
public: anyone can access it.
static: method can be run without creating an instance of the class containing the main method.
void: method doesn’t return any value.
main: the name of the method.

System.out.println()

Inside the main() method, we can use the println() method to print a line of text to the screen:

Example:

{
   System.out.println("Hello World!");
}

The println method prints a line of text to the screen.
The System class and its out stream are used to access the println method.

Semicolons in Java

Each code statement must end with a semicolon as shown in the example below:

class MyClass {
  public static void main(String[ ] args) {
    System.out.println("I am learning Java");
  }
}
Related Post