What is the main method in JAVA?

What is the main method in JAVA?

Main method

public class Pairosoft{ 
   
 public static void main(String[] args) {
   
     System.out.println("Hello Everyone....");
    }
}

class Pairosoft:-This is class syntax class name is Pairosoft. String and System both also class.

public:-public specifies who can access the main method (everyone), the word static specifies how to access the main method.

static:-static is keyword. static allows main to be called without creating an object of the class in which the main method is defined. main Java program will successfully compile but it won't execute.

void:-Void indicates that a method returns nothing.

main:-Main is a Java method like function in C.

(String[] args):-String[] args which tells the computer that the args argument can hold an array of strings.

System.out.println();  :-In Java, System. out. println() is a statement which prints the argument passed to it. The println() method display.








More will come idea if you watch this video:-





Post a Comment

0 Comments