我在那里看到了已生成的class了。 下面是我的程序: public class Ishmael {public static void main(String[] args) {String s="Call me Ishmael."; System.out.println(s); System.out.println("The length of the string is"+s.length()); System.out.println("the first charaster of the string is"+s.charAt(0)); System.out.println("The last charaster of the string is"+s.charAt(s.length()-1)); System.out.println("The first word of the string is"+s.substring(0,s.indexOf(' '))); } }我是用windows系统运行的。
下面是我的程序:
public class Ishmael
{public static void main(String[] args)
{String s="Call me Ishmael.";
System.out.println(s);
System.out.println("The length of the string is"+s.length());
System.out.println("the first charaster of the string is"+s.charAt(0));
System.out.println("The last charaster of the string is"+s.charAt(s.length()-1));
System.out.println("The first word of the string is"+s.substring(0,s.indexOf(' ')));
}
}我是用windows系统运行的。
import java.lang.*;
你需要设置classpath!
如:classpath=.;c:\jsdk1.4.2\jre\lib\rt.jar
设置好后记得关闭dos窗口重新开一个!运行时:java -classpath %classpath% Ishmael