public class OtherTest {
int IP=3;
public static void main(String[] args){
System.out.println(IP);
}}说不能对非静态字段IP进行静态引用,请问错误出在什么地方 ,是main里的必须用静态还是println里的用静态?
int IP=3;
public static void main(String[] args){
System.out.println(IP);
}}说不能对非静态字段IP进行静态引用,请问错误出在什么地方 ,是main里的必须用静态还是println里的用静态?
static int IP=3;//static add.try again.
public static void main(String[] args){
System.out.println(IP);
}}
或者
public class OtherTest {
int IP=3;
public static void main(String[] args){
OtherTest O=new OtherTest();//new ,try again.
System.out.println(O.IP);
}}