why java main method is given as static method?
Answers were Sorted based on User's Feedback
Answer / saravanan.v
Java is a object oriented language.So even main method also should be written inside a class name main class.So main method should be called WITHOUT CREATING OBJECT for main class.For this purpose, it is declared as static.
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / chaithanya
main method is called by JVM.without creating the object we are calling main.that's what it is declared Static.
static nothing but without creating the object,we can call that method
| Is This Answer Correct ? | 2 Yes | 0 No |
What are the advantages of the model over the event- inheritance model?
What are features of java?
What is parsing a string?
Interface A { String test(); } Interface B { int test(); } Create a class AB which must implements both A & B interfaces.
Can we define private and protected modifiers for the members in interfaces?
10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile? a)Direction d = NORTH; b)Nav.Direction d = NORTH; c)Direction d = Direction.NORTH; d)Nav.Direction d = Nav.Direction.NORTH;
Is string serializable in java?
what is deadlock in threads? with example
what are literals in java?
What is slash r?
What is java thread dump, how can we get java thread dump of a program?
Explain the inheritance?