Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can we override the main method?

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


Please Help Members By Posting Answers For Below Questions

What is the buffer limit?

1030


What is arraylist class in java?

1071


What is the base class for error and exception?

1001


Which command from the jdk compiles a java program?

999


Why do we need wrapper class?

1002


Is treeset sorted in java?

993


Define locale.

1040


What is Java Reflection API? Why it’s so important to have?

1167


Why is string class considered immutable?

1057


Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?

1134


What is difference between word and integer?

1080


Explain yield() method in thread class ?

1069


What is a stack class in java ?

1109


how to create daemon thread in java?

1080


What is a java object and java application?

1058