Why do we use public static with the main function in Java?
Answer Posted / balaji kumar
public - it can be access outside of the(class, package,
subclass and world).
Static- It is used to run a method without any references of
a class. Then JVM will check all the 'static' methods in
"main class" and run the main method from those.
void- main method always has no return value to outside
methods or others. so it uses void keyword.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are local variables?
What is numeric data type?
What is number data type in java?
How to create an interface?
Explain the term virtual machine?
How do generics work in java?
What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
What is difference between word and integer?
Difference between arraylist and hashset in java?
What is difference between static class and singleton pattern?
What is an example of a boolean?
which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?
What are the two types of java programming?
Why are there no global variables in java?
What is the purpose of default constructor?