Help with Java - University of Queensland Australia | Programming with Java - University of Queensland Australia

Legacy can be characterized as the procedure where one class secures the properties (techniques and fields) of another. With the utilization of legacy the data is made reasonable in a various leveled arrange.

The class which acquires the properties of other is known as subclass (inferred class, kid class) and the class whose properties are acquired is known as superclass (base class, parent class).

expands Keyword

stretches out is the catchphrase used to acquire the properties of a class. Taking after is the language structure of broadens catchphrase.

Linguistic structure

class Super {




class Sub expands Super {




The super catchphrase

The super catchphrase is like this watchword. Taking after are the situations where the super catchphrase is utilized.

It is utilized to separate the individuals from superclass from the individuals from subclass, on the off chance that they have same names.

It is utilized to conjure the superclass constructor from subclass.

Separating the Members

On the off chance that a class is acquiring the properties of another class. What's more, if the individuals from the superclass have the names same as the sub class, to separate these factors we utilize super catchphrase as demonstrated as follows.



Summoning Superclass Constructor

On the off chance that a class is acquiring the properties of another class, the subclass naturally secures the default constructor of the superclass. Be that as it may, in the event that you need to call a parameterized constructor of the superclass, you have to utilize the super catchphrase as demonstrated as follows.


IS-A will be a method for saying: This protest is a sort of that question. Give us a chance to perceive how the stretches out catchphrase is utilized to accomplish legacy.

open class Animal {


open class Mammal amplifies Animal {


open class Reptile amplifies Animal {


open class Dog amplifies Mammal {


Presently, in light of the above case, in Object-Oriented terms, the accompanying are genuine −

Creature is the superclass of Mammal class.

Creature is the superclass of Reptile class.

Warm blooded creature and Reptile are subclasses of Animal class.

Pooch is the subclass of both Mammal and Animal classes.

Presently, in the event that we consider the IS-A relationship, we can state −

Warm blooded creature IS-An Animal

Reptile IS-An Animal

Pooch IS-A Mammal

Consequently: Dog IS-An Animal also

With the utilization of the broadens watchword, the subclasses will have the capacity to acquire every one of the properties of the superclass aside from the private properties of the superclass.

We can guarantee that Mammal is really an Animal with the utilization of the case administrator.

The instanceof Keyword

Give us a chance to utilize the instanceof administrator to check figure out if Mammal is really an Animal, and canine is really an Animal.

HAS-A relationship

These connections are predominantly in view of the use. This figures out if a specific class HAS-A specific thing. This relationship diminishes duplication of code and additionally bugs.

In Object-Oriented element, the clients don't have to fret over which question is doing the genuine work. To accomplish this, the Van class conceals the usage subtle elements from the clients of the Van class. Along these lines, fundamentally what happens is the clients would request that the Van class do a specific activity and the Van class will either take every necessary step independent from anyone else or request that another class play out the activity.

Our Team

We have 2500+ expert pool from all over the world. They are highly qualified and well experienced. All experts have experinced in teaching and good command over programming topics. Some of our experts are as follows:

John Doe

JAVA EXPERT(10+ Yrs Exp.)

Larry Doe

C EXPERT(12+ Yrs Exp.)

Ranith Kays

C++ EXPERT(8+ Yrs Exp.)

Joan Ray