Q:

Public static variable not recognized outside constructor or method body

I initialized a variable that is public and static in a Class A. Class A is inherited by a certain Class B but when I try to update a value to that variable outside the scope of a constructor or a method body, I get an error saying that an identifier is expected.  But when I am updating the variable value inside the scope of a constructor or a method, there doesn't seem to be a problem and everything works perfectly.  I am puzzled and would like to know more about this.  I have attached my code below. 
A.java
public class A{
public static int varA = 23;
}

B.java  (Identifier expected error occurs in this version)
public class B extends A{
varA = 93;
}

B.java (No error and everything works fine upon instantiating it in main program)
public class B extends A{
public B(){
varA = 96;
}
\\or
public void methodB(){
varA = 93;
} 
}

A:

because you write all your code inside methods (constructor is a method as well, but you can't call it, it's called by jvm at instancte creation only once)
Outside of methods, you can only declare fields, and initialize values of thease fields (that's what you have done in class A).  But varA = 93; is not a declaration, it's an instruction.  And all instruction must be inside methods (or static scope)
So you can use following static scope block in class B:
static {
    varA = 93;
}

this will compile fine.