0% found this document useful (0 votes)
20 views1 page

Exercise - 4 Subject: Java Programming

The document provides 9 programming exercises on Java inheritance concepts including single, multi-level, hierarchical and hybrid inheritance. It also covers method overriding, accessing hidden variables, subclass constructors, interface inheritance, abstract classes, multiple inheritance using interfaces, and final classes.

Uploaded by

KM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Exercise - 4 Subject: Java Programming

The document provides 9 programming exercises on Java inheritance concepts including single, multi-level, hierarchical and hybrid inheritance. It also covers method overriding, accessing hidden variables, subclass constructors, interface inheritance, abstract classes, multiple inheritance using interfaces, and final classes.

Uploaded by

KM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Christ Polytechnic Institute, Rajkot Programming in Java (3350703)

Exercise – 4

Subject: JAVA PROGRAMMING

1. Write a program in Java to demonstrate Single Inheritance, Multi-Level Inheritance,

Hierarchical Inheritance and Hybrid Inheritance.

2. Create a class “Leap” to find out whether the given year is leap year or not. Use inheritance

for this program.

3. Write a program in Java that demonstrates method-overriding.

4. Write an application that illustrates how to access a hidden variable. Class A declares a

static variable x. The class B extends A and declares an instance variable x. display( )

method in B displays both of these variables.

5. Write a program in Java in which a subclass constructor invokes the constructor of the super

class and instantiate the values.

6. Write a program that demonstrates interface inheritance.

7. Describe abstract class called Shape which has three subclasses say Triangle, Rectangle, and

Circle. Define one method area()in the abstract class and override this area( ) in these three

subclasses to calculate for specific object i.e. area( ) of Triangle subclass should calculate

area of triangle etc. Same for Rectangle and Circle.

8. Write a program in Java to demonstrate implementation of multiple inheritance using

interfaces.

9. Write a program in Java to demonstrate use of final class.

Prepared by | Hemang R Chath

You might also like