package pack;
public class Pack {
static public int x1 = 7;
protected int x2 = 8;//#1
static int x3 = 9;
static private int x4 = 10;
}
import pack.Pack;
public class
Test extends Pack {
Test(){
try{
throw new RuntimeException();
}finally{
System.out.println("runtime");
}
}
public static void main(
String[] args){
Pack p = new Pack();
System.out.println(p.x2);
}
}
why #1 x2 can be accessed?
if you delete "static" modifier,then x2 is invisible?
can someone explain why?
thank you in advance^^