public class Father \{ public String name; public int age; // customer name Father() namew"Hassan"; agew50; public void
Posted: Thu Jul 14, 2022 2:13 pm
public class Father \{ public String name; public int age; // customer name Father() namew"Hassan"; agew50; public void display()\{ System.out.println("Name:"+name); System.out.println("Age: "tage); ) ] Figure 3 i. Based on Figure 3, create a class named Child that inherits the Father class. Declare an instance name location (String) for class Child. ii. Define a constructor in class Child and give an appropriate initial values for the instance (name, age, location). iii. Define a method display O in class Child, execute the display () method in superclass using the keyword super. Method display ( ) in class Child should print the information of name, age and location.
iv. Create other class named Main for the main method and create 2 objects for the 2 classes (Father and Child). Then execute the display () method for Father and Child. Example of the output as in Figure 4: Father" 5 info: Narte: Hassan Age: 50 ch11d's 1 nfo? Name : Ar1qa Age: 21 Location: KL
iv. Create other class named Main for the main method and create 2 objects for the 2 classes (Father and Child). Then execute the display () method for Father and Child. Example of the output as in Figure 4: Father" 5 info: Narte: Hassan Age: 50 ch11d's 1 nfo? Name : Ar1qa Age: 21 Location: KL