System.out.println("s.doSomething() returns " + doSomething());
这样写:System.out.println("s.doSomething() returns " + s.doSomething());
或者这样:public class Something {
public static void main(String[] args) {
System.out.println("s.doSomething() returns " + doSomething());
}
public static String doSomething() { //像楼上说的加static
return "Do something ...";
}
} |