Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Java program on rodent hierarchy

Categories: Inheritance. No Comments on Java program on rodent hierarchy

In this article we will learn to implement a Java program on rodent hierarchy. A Java program is provided below which uses the rodent hierarchy to demonstrate inheritance in Java.   Java program to create an inheritance hierarchy of Rodent, Mouse, Gerbil, Hamster etc. In the base class provide methods that are common to all Rodents […]

Read the rest of this entry »

Java program on shape hierarchy

Categories: Inheritance. No Comments on Java program on shape hierarchy

In this article we will learn to implement a Java program on shape hierarchy. The requirements for writing the program is specified below.   Java program to create an abstract class named Shape that contains an empty method named numberOfSides( ).Provide three classes named Trapezoid, Triangle and Hexagon such that each one of the classes […]

Read the rest of this entry »

Java program that illustrates how runtime polymorphism is achieved

Categories: Inheritance. No Comments on Java program that illustrates how runtime polymorphism is achieved

In this article we will learn to implement a Java program that illustrates how runtime polymorphism is achieved. A Java program is provided below that demonstrates how runtime polymorphism is achieved. abstract class Figure { int dim1, dim2; Figure(int x, int y) { dim1 = x; dim2 = y; } abstract void area(); } class […]

Read the rest of this entry »