Q:

How do i print Inputs captured in one class as Outputs in another class in Java?

In order to understand Classes/Inheritance, I was writing java program to calculate bmi and I have 2 classes in my program one is to take the inputs and other class to display output. However, I am not able to see my captured inputs from the output window rather I am seeing null/blanks
Please find the program, and help me/guide me with correct code.
Package programspractice;
import java.util.Scanner;

class bmipatino 
{
    static Scanner sc=new Scanner(System.in);

    String name;
    int age;
    double height;
    double weight;

    static void patinfos()
    {
        System.out.println("Enter the name of the Patient ");
        String name=sc.nextLine();
        System.out.println("Enter the age of patient ");
        int age=sc.nextInt();
        System.out.println("Enter the Height of patient");
        double height=sc.nextDouble();
        System.out.println("Enter Weight of the patient");
        double weight =sc.nextDouble();
    }
}

public class BmiUsingMethods extends bmipatino
{
    void vitals()
    {
        System.out.println("Patients name is  "+super.name);
        System.out.println("Patients Age is  "+super.age);
        System.out.println("Patients Height is  "+super.height);
        System.out.println("Patients Weight is  "+super.weight);
    }

    public static void main(String[] args) 
    {
        BmiUsingMethods ref = new BmiUsingMethods();        
        ref.patinfos();
        ref.vitals();
    }
}

A:

You have multiple problems in your code. Your patinfos() is static, so the values are not bound to a specific instance of the class.
You redefine name, age, etc in this static method, and they shadow the instance variables.
So if you remove the static keyword and local variable declarations, this will work:
void patinfos()
{
    System.out.println("Enter the name of the Patient ");
     name=sc.nextLine();
    System.out.println("Enter the age of patient ");
     age=sc.nextInt();
    System.out.println("Enter the Height of patient");
     height=sc.nextDouble();
    System.out.println("Enter Weight of the patient");
     weight =sc.nextDouble();
}

