How to refer from class1 to a class2 instance variable?
For example, from here we turn:
public class Main { public static void main(String[] args) { System.out.println(object1.a); //ошибка } } }
And the class in which the object1 variable is declared is in the same package:
public class Solution { int a = 555; public static void main(String[] args) { Solution object1 = new Solution(); } }