I am very new to java.
I have just begun with using multiple classes and I wonder how i get a value from another class.
For example I want to get a value from the seocnd class into the main class and then print it from there.
Printable View
I am very new to java.
I have just begun with using multiple classes and I wonder how i get a value from another class.
For example I want to get a value from the seocnd class into the main class and then print it from there.
Is this a static value or an instance field?
Its a static value
As long as the variable which holds the desired value is accessible to your client class, ClassName.variableName is how you access the value.