源程序如下:大家帮忙看看有什么问题;
package langexample;
import java.io.*;public class SystemExample{
public SystemExample(){
}
public static void main(String args[]){
System.out.println(System.currentTimeMillis());
System.out.println(System.getProperty("java.version"));
System.out.println(System.getProperty("os.name"));
System.out.println(System.getProperty("os.version"));
System.out.println(System.getProperty("java.vm.name"));
System.out.println(System.getProperty("java.vendor.url"));
System.out.println("-------------------------------------------------");
System.out.println("Please input a number,I'll add ten to it .");
float f1;
try{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
String s=br.readLine();
f1=Float.parseFloat(s);
System.out.println(f1+10);
}catch(IOException ioe){
ioe.printStackTrace();
}
}
}
package langexample;
import java.io.*;public class SystemExample{
public SystemExample(){
}
public static void main(String args[]){
System.out.println(System.currentTimeMillis());
System.out.println(System.getProperty("java.version"));
System.out.println(System.getProperty("os.name"));
System.out.println(System.getProperty("os.version"));
System.out.println(System.getProperty("java.vm.name"));
System.out.println(System.getProperty("java.vendor.url"));
System.out.println("-------------------------------------------------");
System.out.println("Please input a number,I'll add ten to it .");
float f1;
try{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
String s=br.readLine();
f1=Float.parseFloat(s);
System.out.println(f1+10);
}catch(IOException ioe){
ioe.printStackTrace();
}
}
}
怎么改?
我把 package langexample; 这一行删了就可以了,
这是为什么呢?
你应该把你编译出来的SystemExample.class放在 C:\aaa\bbb\ccc\langexample\SystemExample.class
然后在C:\aaa\bbb\ccc\敲入 java langexample.SystemExample 就可以通过了。
你自己要注意package的路径