Answer Posted / sadikhasan palsaniya
Yes we can override main method that explain by following Code.
public class DemoOverride {
public static void main(String string[]){
System.out.println("I am in Main method of super class");
String str[]={"sadik","palsnaiya"};
Over1.main(str);
Over2.main(str);
}
}
class Over1 extends DemoOverride{
public static void main(String str[]){
System.out.println("I am in Main method of Middle
class");
}
}
class Over2 extends Over1{
public static void main(String str[]){
System.out.println("I am in Main method of Child class");
}
}
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
What is protected access modifier?
How many types of memory areas are allocated by jvm?
What is a double?
What’s meant by anonymous class?
What is jee6?
How do I write a self declaration?
How would you use Bubble Sort to sort the number of elements?
What is the difference between dom and sax parser in java?
Is a copy constructor?
How many types of java are there?
How many ways can we create the string object?
What is an immutable class? How to create an immutable class?
What do you understand by the bean persistent property?
Can we create more than one object singleton class?
Explain working of call by reference function invoking.