single inheritance

Description:

Program which will accept name,age,height and weight from the user . It shows the output Test Case 1 Input (stdin) Hari 20 5.2 50 Expected Output Name:Hari Age:20 Height:5.2 Weight:50 Test Case 2 Input (stdin) Jai 21 5.5 45 Expected Output Name:Jai Age:21 Height:5.5 Weight:45

Program :

import java.util.*;

public class TestClass {

 public static void main(String[] args) {

       y sha=new y();

       sha.display();

       

     }

}

     

       

       class x{

         Scanner in=new Scanner(System.in);

         

       

      String  a=in.nextLine();

       int b=in.nextInt();

       double c=in.nextDouble();

      int d=in.nextInt();

       }

       class y extends x{

         void display()

         {

         System.out.println("Name:"+a);

         System.out.println("Age:"+b);

         System.out.println("Height:"+c);

         System.out.println("Weight:"+d);

         }

       }