Blog Archives

Interfaces in Java

An interface in Java represents an abstract type; it is a collection of abstract methods and constants. All methods in an interface are abstract, and thus they have only signatures. All variables in an interface are implicitly final and static,

Tagged with: , , , ,
Posted in Java

Polymorphism in Java

A polymorphic reference is a variable that can refer to different types of objects. A reference can refer to an object of its class, or to an object of any subclass. When we call a method through a polymorphic reference,

Tagged with: , , ,
Posted in Java

Inheritance in Java

The following are different relationships between classes. Let A and B be two classes. Dependency: A uses B Aggregation: A has-a B (as an attribute) Inheritance: B is a kind of A Subclass and Superclass In Java, new classes (child

Tagged with: , , , , , ,
Posted in Java