Why do we use public static with the main function in Java?
Answers were Sorted based on User's Feedback
Answer / abhi
why all these guys used to say "no need to create objects for a static class" tell what advantages u wil b geting without creating an object.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ankit
public is written so that it can be called from outside and
static is written because main is called before the creation
of any object and for static methods object is not required.
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / deepak divvela
In the main function generally we are using
public static void main(String args[])
that means public is used for call method without being the
member of the class.
and static is used for to call method directly with no need
of the object creation.
| Is This Answer Correct ? | 3 Yes | 7 No |
What is a finally block? Is there a case when finally will not execute?
Which of the following can be referenced by a variable? A. The instance variables of a class only B. The methods of a class only C. The instance variables and methods of a class
Give example to differentiate between call by value and call by reference.
What is anagram word?
What about method local inner classes or local inner classes in java?
How do you relate a Interface to a Class? Tell me in Detail?
Why generics are used in java?
What is autoboxing in java?
What is thread?
What is the difference between add() and addElement() method in Vector Class ?
What is identifier with example?
What are the Abstract Classes provided by Java?