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
Give me some null interfaces in java?
What are the object and class classes used for?
What is nested loop? What is dangling else condition in it?
What is the purpose of static keyword in java?
make a method which any number and any type of argument and print sum of that arguments.....
Can abstract class have private constructor?
How many bits is a string in java?
Why java is considered as platform independent?
Can we declare a class as static?
What is the reason behind using constructors and destructors?
What is map and hashmap in java?
What is percentage in java?
Why object class is super class for every class in java?
Is arraylist ordered?
Explain public static void main(string args[]).