KeyboardInput 类你写了吗?这个类是要自己写的,不然就不会成功运行
解决方案 »
- 求解释 jdbc的东西 不明白为什么
- 关于fms 录音的问题
- JFreeChart 坐标轴如何做到单向缩放?
- webservice客户端报错
- 读取Hibernate属性文件
- (100分)求救:Hibernate+Struts工程从Windows移植到Linux报错
- 请问一下 我家的宽带上网每次 ip都一样要是我想用软件改ip 比如有的网站 一上去就知道你的ip 我做个虚礼的ip可以吗
- 问一些初学者的弱者问题
- 在jb9中配置weblogic服务器,选择bea home directory时,选择了bea的安装路径,可总是提示registy.xml does not exist;
- 刚学j2ee请教关于编辑器的问题
- JDBC SQL 2000 的连接选项
- 我在TOMCAT下运行JSP文件,老是出现IE的文件下载提示,有什么办法可以解决吗?
public class KeyboardInput {
private final BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
public final synchronized int readInteger(){
String input="";
int value=0;
try{
input=in.readLine();
}catch(IOException e){}
if(input!=null){
try{
value=Integer.parseInt(input);
}catch(NumberFormatException e){}
}
return value;
}
public final synchronized long readLong(){
String input="";
long value=0L;
try{
input=in.readLine();
}catch(IOException e){}
if (input!=null){
try{
value=Long.parseLong(input);
}catch(NumberFormatException e){}
}
return value;
}
public final synchronized double readDouble(){
String input="";
double value=0.0D;
try{
input=in.readLine();
}catch(IOException e){}
if(input!=null){
try{
value=Double.parseDouble(input);
}catch(NumberFormatException e){}
}
return value;
}
public final synchronized float readFloat(){
String input="";
float value=0.0F;
try{
input=in.readLine();
}catch(IOException e){}
if(input!=null){
try{
value=Float.parseFloat(input);
}catch(NumberFormatException e){}
}
return value;
}
public final synchronized char readCharacter(){
char c=' ';
try{
c=(char)in.read();
}catch(IOException e){}
return c;
}
public final synchronized String readString(){
String s="";
try{
s=in.readLine();
}catch(IOException e){}
if(s==null){
s="";
}
return s;
}
}
你在试试看能不能运行。
public final synchronized long readLong();
public final synchronized double readDouble();
public final synchronized float readFloat();
public final synchronized char readCharacter();
public final synchronized String readString();
里面的final 去掉,就ok了。因为声明为final 的函数只能在本类中调用。