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

Explain the concept of proper inheritance?

1064


How does multithreading take place on a computer with a single cpu?

998


What is binary search in java?

985


What are thread local variables?

1138


What does s mean in regex?

1010


What is runtime polymorphism or dynamic method dispatch?

1004


Can a final variable be manipulated in java?

977


Can static method access instance variables ?

1126


What is fail fast in java?

1155


Why stringbuilder is not thread safe in java?

1009


Should you use singleton pattern?

934


What do you understand by garbage collection in Java? Can it be forced to run?

979


When a byte datatype is used?

2182


Why java is not 100% object-oriented?

1500


What is the null?

1015