Java Inconsistenties [resolved]
I noticed some things in Java that im not sure why they are allowed. Any comments?
1.) why does a constructor allow static members to be initialized?
2.) why is a non static member able to be initialized out side
of its class constructor?
Code:
// why does a constructor allow static members to be initialized?
// why is a non static member able to be initialized out side
// of its class constructor?
class Test2{
static int x;
static int w = 54;
int z = 56;
public Disassembler(){
x = 73; // ?
}
}
public class Test1{
public static void main(String[] args){
Disassembler d = new Disassembler();
System.out.println(Disassembler.x);
System.out.println(Disassembler.w);
System.out.println(d.z);
}
}