I am not able to compile the following code. Not able to understand the compilation process here. why the main class instances are not been visible to other classes(test1). why it failing at compilation. Please help.
public class test {
public int i = 10;
public static void main(String[] args) {
System.out.println("test main");
}
}
class test1 {
test t = new test();
System.out.println(t.i);
}