The keyword public is an access specifier. A variable or a method that is declared public is publicly accessible to any member of the project. Any class or method can freely access other public methods and variables of another class.
If I understand your question, you want to know why the main method in java:
public static void main(String[] args)
is public, this is because when your program runs, the Java interpreter looks for the information on the location of the main method, then it looks for and runs the main method, but since it isn't in any class, it can't access any private methods, and therefore, the main method must always be public.
I hope I answered your question,
Mike
no public is not data type its accessor which publicaly access the classes or method
public is an access modifier in Java that allows all classes and methods uncontrolled access to the class or the variable that is defined with the keyword public in their definition.
Subroutine mean what (in java)?
public
public static void main
Java's main function denotes the entry point into the execution of your program.
A Program in Java that spawns multiple threads is called a multithreaded program in Java.
Java 1.0a2 was the first public release.
Java was developed in the early 1990's by James Gosling at Sun Microsystems. Java was introduced to the public in 1995.
Yes, it can. However, there can only be one public class per .java file, as public classes must have the same name as the source file.
Subroutine mean what (in java)?
public
public static void main
System.out refers to the Java console.
The Java Brewing Company is not a public company and, thus, does not have a ticker symbol for trading.
In eclipse java beans can be created by using getters and setters. Example: public class Login { public String lmail; public String getLmail() { return lmail; } public void setLmail(String lmail) { this.lmail = lmail; }
default it is public type
Java's main function denotes the entry point into the execution of your program.
A Program in Java that spawns multiple threads is called a multithreaded program in Java.