Exercise - 4 Subject: Java Programming
Exercise - 4 Subject: Java Programming
Exercise – 4
2. Create a class “Leap” to find out whether the given year is leap year or not. Use inheritance
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( )
5. Write a program in Java in which a subclass constructor invokes the constructor of the super
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
interfaces.