[求助]小问题!
public class part2di5ti {String s = "Hello, World!";
int storage(String s) {
return s.length() * 2;
}
/* void print() {
System.out.println(
"storage(s) = " + storage(s));
}*/
public static void main(String[] args) {
part2di5ti st = new part2di5ti();
// st.print();
System.out.println(st.storage(s));
}
}
这么写为什么会出错?
part2di5ti.java:13: non-static variable s cannot be referenced from a static context
System.out.println(st.storage(s));
注示的写法与我写的有什么不同?