answersLogoWhite

0

What is public inheritance in java?

Updated: 8/19/2019
User Avatar

Wiki User

13y ago

Best Answer

Inheritance is a Java feature by which we can reuse code and programming logic from one class in another class. We implement Inheritance using the extends keyword.

Ex: public class Ferrari extends Car {…}

Here the Ferrari Class will extend features from the Car Class.

This is Inheritance. The different types of Inheritance are:

  1. Single Inheritance
  2. Multi-Level Inheritance
  3. Multiple Inheritance (Java supports only Partial Multiple Inheritance) and
  4. Hybrid Inheritance
User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is public inheritance in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does java not support?

Java does not support multiple inheritance.......


How can you write multiple inheritance program in java?

Java does not support direct multiple inheritance. You can implement partial multiple inheritance using interfaces. ex: public class ExMultInherit implements interface1, interface2, interface 3 { ... .... ...... }


Java program to demonstrate multiple inheritance?

Inheritance is one of the building blocks of Java and it is used extensively in all java based applications. Inheritance is everywhere in Java. I can't think of one java project that I worked on, where inheritance wasn't used. Inheritance is the feature wherein the properties/qualities of a parent class or interface is used in the child class. Both Classes & Interfaces are used in Java Inheritance


What is ambiguity in multiple inheritance?

Java does not support multiple inheritance


Multiple inheritance in java?

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces. Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {


What kind of inheritance is not allowed in java?

Java does not allow the multiple inheritance of concrete classes, though it does allow a "hybrid" inheritance of one concrete class and multiple interfaces.


Can we implement multiple inheritance in java using package and interface?

Yes. Java does not support full fledged/proper multiple inheritance. But, whatever partial inheritance that Java supports can be implemented using interfaces Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces. Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…} And this is under the assumption that Car and Automobile are interfaces. Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance.


What is problem in multiple inheritance?

Java does not support direct multiple Inheritance. Harder to implement, not every language support it: C++ does, Java does not.


Give the structure of multiple inheritance?

Java does not support multiple inheritance. It is done with the help of interfaces in java. a class can implement n number of interfaces, thus showing multiple inheritance. but a class cannot extend multiple classes in java.


How does inheritance support multiple inheritance in java in example?

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces. Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…} And this is under the assumption that Car and Automobile are interfaces. Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance.


What is multiple inheritance in java?

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces. Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…} And this is under the assumption that Car and Automobile are interfaces. Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance.


How you possible multiple inheritance in java?

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces. Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…} And this is under the assumption that Car and Automobile are interfaces. Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance