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...

Will it be called overriding if I do not change the
parameters or return type, instead throw a different
exception in the method signature.

Answer Posted / siva

public class MyOverriding {
int add(int a, int b)throws Exception{ //TRUE
return a+b;
}
}
class SubClass extends MyOverriding {
int add(int a, int b)throws NullPointerException{
return a+b;
}
}

//BELOW CODE IS GETTING COMPILER ERROR
public class MyOverriding {
int add(int a, int b)throws NullPointerException{
return a+b;
}
}
class SubClass extends MyOverriding {
int add(int a, int b)throws Exception{
return a+b;
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is colon_pkg_prefixes and what is its use?

2520


what are getters and setters in Java with examples?

1781


What are callback interfaces?

1094


Can you control when passivation occurs?

1068


What is the difference between a static and a non-static inner class?

1158


Java is fully object oriented languages or not?

1000


Do you think that java should have had pointers?

1060


Are there books about seam?

1111


Where can I ask questions and make suggestions about seam?

1057


How would you create a button with rounded edges?

1153


What is the map interface?

1125


What is abstract schema?

1028


What is the difference between the font and fontmetrics classes?

1159


Why do threads block on i/o?

1261


Brief description about local interfaces?

1272