请教一个例子的问题
谁帮忙看一下,,这错在哪import java.io.*;
public class exercise1 {
String greeting ="Hello";
final String s =greeting.substring(0,4);
public static void main(String args[]){
System.out.println("It is:" + s);
}
}
错误提示:
exercise1.java:6: non-static variable s cannot be referenced from a static context
System.out.println("It is:" + s);
^
1 error
谢谢先了