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

How multipleInheritance is possible in java?

Answer Posted / srikanth

Multiple Inheritance is possible in java through interfaces only. Where as in C++ it is possible through classes also. Because in C++ there is one operator called scope Resolution operator, by this we can uniquely call one method of super classes. But we have no such operator in java, so it is not possible for a class to be inherited from multiple classes but possible with interfaces. For example,

class MyClass implements interface1,interface2....
{
// code
}
One more thing is, we can define our class from combination of interface and class also. But, combination should contain only one class and one or more interfaces. Ultimately class should be inherited from one class only.
class MyClass extends Class1 implements interface
{
//code
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List some important characteristics on jre

1128


What are the different types of sorting in java?

1020


Explain what pure virtual function is?

1062


how come we know the object is no more used in the class?

6549


What is the preferred size of a component in java programming?

1044


What is integers and example?

1045


What is meant by vector class, dictionary class, hash table class, and property class?

1230


Will minecraft java be discontinued?

1221


What are java packages?

1080


how can you catch multiple exceptions in java?

1058


How do you check if a character in a string is a digit or letter?

1121


Can substring create new object?

1181


What is a flag and how does it work?

1061


How does arraylist size increase in java?

1166


Differentiate between run time error and syntax error.

1190