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 protected access modifier?

958


How many types of memory areas are allocated by jvm?

976


What is a double?

1042


What’s meant by anonymous class?

1021


What is jee6?

1012


How do I write a self declaration?

1018


How would you use Bubble Sort to sort the number of elements?

952


What is the difference between dom and sax parser in java?

924


Is a copy constructor?

1000


How many types of java are there?

931


How many ways can we create the string object?

963


What is an immutable class? How to create an immutable class?

1006


What do you understand by the bean persistent property?

951


Can we create more than one object singleton class?

989


Explain working of call by reference function invoking.

968