- main method is inherited by child class.
- if child class contains main method, then the main method of parent class (if contains) will become hidden.
- all static methods of parent class will be accessible from child class, if a static method with same signature as that of Parent class exists in Child class then the Parent class method will be hidden from Child class view.
- Overloading of main method is allowed but JVM always calls the one with 'String[] args' argument. other main methods will be like normal methods.
- if main method is not defined, till Java 6, JVM used to throw a RunTimeException as 'NoSuchMethod Error'. from Java7, it wil throw an error and suggests to define main method.
- till Java6, static blocks used to get execute before searching for main method. from Java7, static blocks wont get executed if class doesn't have main method.
- if child class contains main method, then the main method of parent class (if contains) will become hidden.
- all static methods of parent class will be accessible from child class, if a static method with same signature as that of Parent class exists in Child class then the Parent class method will be hidden from Child class view.
- Overloading of main method is allowed but JVM always calls the one with 'String[] args' argument. other main methods will be like normal methods.
- if main method is not defined, till Java 6, JVM used to throw a RunTimeException as 'NoSuchMethod Error'. from Java7, it wil throw an error and suggests to define main method.
- till Java6, static blocks used to get execute before searching for main method. from Java7, static blocks wont get executed if class doesn't have main method.
No comments:
Post a Comment