[Solved] Access a variable across multiple classes JAVA


Sure this is possible 😀 There are many ways to do so.

For example you can easily do this:

//Obviously pseudo Code...u need a constructor..or method
Public Class A{
            Scanner input = new Scanner(System.in);
            System.out.println("Please input the weight:");
            bagWeight=input.nextDouble();
            B b = new B();
            double total = b.method(1337, bagWheight);
            System.out.println("The total weight is: "+total);
    }

solved Access a variable across multiple classes JAVA