
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7442 Articles for Java

869 Views
IS-A RelationshipIS-A is a way of saying − This object is a type of that object. Let us see how the extends keyword is used to achieve inheritance. public class Animal { } public class Mammal extends Animal { } public class Reptile extends Animal { } public class Dog extends Mammal { }Now, if we consider the IS-A relationship, we can say −Mammal IS-A AnimalReptile IS-A AnimalDog IS-A MammalHence: Dog IS-A Animal as wellWith the use of the extends keyword, the subclasses will be able to inherit all the properties of the superclass except for the private properties of the ... Read More

2K+ Views
Java is a programming language that follows the Object-Oriented Programming paradigm. One of the pillars of OOPs is Inheritance, where you can find a relationship between two classes as Parent and Child. This relationship allows these classes to reuse each other's attributes and methods. Java classes can relate to each other in many ways such as, Is-A relationship and Has-A relationship. In this article, we are going to learn the concept of Has-A relationship in Java through examples. HAS-A Relationship in Java Has-A relationship is a type of association where two classes are linked to each other through objects. Here, ... Read More

2K+ Views
Java is a programming language that follows the Object-Oriented Programming paradigm. One of the pillars of OOPs is Inheritance, where you can find a relationship between two classes as Parent and Child. This relationship allows these classes to reuse each other's attributes and methods. Java classes can relate to each other in many ways such as, Is-A relationship and Has-A relationship. In this article, we are going to learn the concept of Has-A relationship in Java through examples. HAS-A Relationship in Java Has-A relationship is a type of association where two classes are linked to each other through objects. Here, ... Read More

2K+ Views
Java is a programming language that follows the Object-Oriented Programming paradigm. One of the pillars of OOPs is Inheritance, where you can find a relationship between two classes as Parent and Child. This relationship allows these classes to reuse each other's attributes and methods. Java classes can relate to each other in many ways such as, Is-A relationship and Has-A relationship. In this article, we are going to learn the concept of Has-A relationship in Java through examples. HAS-A Relationship in Java Has-A relationship is a type of association where two classes are linked to each other through objects. Here, ... Read More

43K+ Views
Multiple inheritance is a type of inheritance where a single subclass inherits multiple superclasses. As the name suggests, inheritance is the ability of a class to inherit members of another class. The class whose properties are inherited is called a superclass, whereas the class that inherits a superclass is called a subclass. We use the extends keyword to inherit the members of a class. Unlike other object-oriented programming languages, Java does not support multiple inheritance. As an alternative, we can implement multiple inheritances from a single class. Why Java Does Not Support Multiple Inheritance When a single class inherits the ... Read More

43K+ Views
Multiple inheritance is a type of inheritance where a single subclass inherits multiple superclasses. As the name suggests, inheritance is the ability of a class to inherit members of another class. The class whose properties are inherited is called a superclass, whereas the class that inherits a superclass is called a subclass. We use the extends keyword to inherit the members of a class. Unlike other object-oriented programming languages, Java does not support multiple inheritance. As an alternative, we can implement multiple inheritances from a single class. Why Java Does Not Support Multiple Inheritance When a single class inherits the ... Read More

43K+ Views
Multiple inheritance is a type of inheritance where a single subclass inherits multiple superclasses. As the name suggests, inheritance is the ability of a class to inherit members of another class. The class whose properties are inherited is called a superclass, whereas the class that inherits a superclass is called a subclass. We use the extends keyword to inherit the members of a class. Unlike other object-oriented programming languages, Java does not support multiple inheritance. As an alternative, we can implement multiple inheritances from a single class. Why Java Does Not Support Multiple Inheritance When a single class inherits the ... Read More

86K+ Views
Multilevel inheritance - A class inherits properties from a class which again has inherits properties. Example class Shape { public void display() { System.out.println("Inside display"); } } class Rectangle extends Shape { public void area() { System.out.println("Inside area"); } } class Cube extends Rectangle { public void volume() { System.out.println("Inside volume"); } } public class Tester { public static void main(String[] arguments) { Cube cube = new Cube(); cube.display(); cube.area(); cube.volume(); } } Output Inside display Inside area Inside volume Read Also: Java Inheritance

86K+ Views
Multilevel inheritance - A class inherits properties from a class which again has inherits properties. Example class Shape { public void display() { System.out.println("Inside display"); } } class Rectangle extends Shape { public void area() { System.out.println("Inside area"); } } class Cube extends Rectangle { public void volume() { System.out.println("Inside volume"); } } public class Tester { public static void main(String[] arguments) { Cube cube = new Cube(); cube.display(); cube.area(); cube.volume(); } } Output Inside display Inside area Inside volume Read Also: Java Inheritance

86K+ Views
Multilevel inheritance - A class inherits properties from a class which again has inherits properties. Example class Shape { public void display() { System.out.println("Inside display"); } } class Rectangle extends Shape { public void area() { System.out.println("Inside area"); } } class Cube extends Rectangle { public void volume() { System.out.println("Inside volume"); } } public class Tester { public static void main(String[] arguments) { Cube cube = new Cube(); cube.display(); cube.area(); cube.volume(); } } Output Inside display Inside area Inside volume Read Also: Java Inheritance