



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




MULTILEV EL INHERITA NCE
Multilevel Inheritance :
real world program class Customised_Belt_Watch extends Wrist_Watch { String material="Silicone"; String color="Blue"; //add a variable and perform calc rs. public void data_info() { System.out.println("Belt Material: "+material+"\nBelt color: "+color); //add prices } } class Wrist_Watch { String type="Wrist watch"; String display="Analogue"; //add a variable price= public void getdata() { System.out.println("Wa tch type: "+type+" nWatch Display:
public class Multilevel { public static void main(String[] args) { Customised_Belt_Watch b=new Customised_Belt_Watch(); System.out.println("CUSTOMISED BELT WATCH"); b.getdata(); b.data_info(); Customised_Bracelet_Watch c= new Customised_Bracelet_Watch(); System.out.println("\nCUSTOMISED BRACELETS WITH WATCH"); c.getdata(); c.data_info(); c.display_data();