Personal tools
You are here: Home Comp 170 Introduction to OOP Lab Materials Lab13 Concepts
Document Actions


by Mit Patel last modified 2006-04-18 11:38 PM

These concepts will help finish the lab assingment.

Abstract method and class:

Abstract class consists of abstract method (method with no implementation); although, it is possible to have constructor as well as some defined methods. Abstract class defines an interface for its subclasses where subclasses implement the methods from the abstract class. Abstract method is not needed in Abstract class.

abstract class Shapes {

int x, y;

void moveTo(int newX, int newY) { ... }

abstract void getName();


class Circle extends Shape {

void getName() { //implementation }


class Rectangle extends Shape {

void getName() { //implementation }



Used when one class wants to inherit something from the other class.


The super keyword is used by an object to refer to methods and fields of a class that it has extended.


if (objectA instanceof objectB) -> will yield true if objectA can be upcast to objectB..


This is a reference to the current object which can be used to refer to member of a current object from within method or constructor.

« February 2024 »
Su Mo Tu We Th Fr Sa

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: