non static variable can't be referenced by static context
package gov.archives.core.service;
/**
* Created by pywang on 2016/7/20.
*/
public class Test {
int fvar;
static int cvar;
public static void main(String[] args){
Test t = new Test();
t.fvar = 200;
//this.fvar = 200;
//cvar = 400;
//t.fvar = 200;
//Test.cvar = 400;
System.out.println(fvar);
}
}
/**
* Created by pywang on 2016/7/20.
*/
public class Test {
int fvar;
static int cvar;
public static void main(String[] args){
Test t = new Test();
t.fvar = 200;
//this.fvar = 200;
//cvar = 400;
//t.fvar = 200;
//Test.cvar = 400;
System.out.println(fvar);
}
}