placement of code gives error...
erm... I'm new to Java and i was wondering why the following piece of code won't compile...
public class test {
int i;
i = 1;//This gives a compiler error... It says and <identifier> is expected...
public test() {
System.out.println( i );
}
... //add public void static main(..) and stuff...
}
However, if i write it this way...
public class test {
int i;
public test() {
i = 1; //when i initialize the variable 'i' here, it works fine...
System.out.println( i );
}
...
it works if i write it this why... can anyone tell me why the former is not accepted? Many thanks in advance...

