Skip to content

Subclass and Superclass

October 6, 2013

An ArithmeticException, which is a class, is a subclass or like a child of Exception, which is also a class. Exception then is the superclass of ArithmeticException.

Subclass: Notes::

  1. subclass can access public and protected methods and members
  2. subclass must ¬†initialize its superclass but can’t access directly private methods and members.
  3. subclass only supports one INHERITANCE ( like saying you can only have one child, that’s it, this is to control overpopulation. keke ).
  4. superclass must be imported first in the subclass.

override == this is using or declaring the same name, formal parameters, return type of the methods in the subclass found in its superclass ( this are the good kids ’cause the subclass follow their parent’s parameters.

overload == same with override, but with different parameters. (the delinquents, they make their own parameters).


import packages.Rectangle;

public class Box extends Rectangle
	public Box()
		height = 0;

	public double volume()
		return super.area()*height;

packages.Rectangle :: the class Rectangle found in the folder named packages…

extends :: used to make the Rectangle class a superclass, thus INHERIT its methods and all members.

super() :: used to override the constructor

super.area() :: for overriding the method area() found in the class Rectangle


From → Classes

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Children's Book Reviews

Malav Shah

official Web Site

My Road to Programming

The journey of how I taught myself to program.


Look at what's brewing up guys! we all are work in progress. So don't meander, lets micromesh everything and have candid conversation about every problem related to C, C++ and JAVA. We can rejuvenate the crinkled faces.


A simple guide to programming...


Information Techonology

Rahul's Work

My Work Tips and Tutorial on Various Tech.

Turnip Farmers

Kingdom Scans


Technology news, trends and analysis covering mobile, big data, cloud, science, energy and media

The Neighborhood

is under renovation in preparation for our 6th Season


News About Tech, Money and Innovation


The Diary of a Retiree

50 Year Project

My challenge to visit 192 countries, read 1,001 books, and watch the top 100 movies

[BTW] : Ben Trube, Writer

Writer, Programmer, Singer

My Arch Walkthrough

Arch linux made easy

Don Charisma

because anything is possible with Charisma

SutoCom Solutions

Success & Satisfaction with the Cloud

%d bloggers like this: