If I have this sample code:
public class Test{
static String myVariable = "hi";
public Test(){
System.out.println(myVariable);
System.out.println(Test.myVariable);
}
public static void main(String[] args) throws SQLException{
new Test();
}
}
now both will print "hi" but I want to know what differentiates them and when should I use one over the other or if I should always only use one of them as it is the norm.
I'm sorry for this really basic example but I didn't really bother learning the difference between the two as I got my system to work