错在何处???
各位“大家”好,我是刚刚涉入JAVa领域不久的新人,按照教材上的练习输入如下程序之后,在dos中出现错误,
还请各位大侠,指点迷津,谢谢!!!
package myJava;
//InputData类,提供了fread()和iread()方法,可以从键盘读入浮点数和整数
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.io.*;
public class InputData{
private static String st;
private static String err;
public static int iRead(){
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
err=false;
do{
System.out.flush();
try{st=in.readLine();}
catch(IOException e){System.out.println(e);System.exit(1);}
if(st.length()==0)err=true;
else try{return lnteger.valueOf(st).intValue();}
catch(NumberFormatExcption e){System.out.println(e);
System.out.print("请输入一个整数");err=true;}
}while(err);
return Integer.valueOf(st).intValue();
}
public static float fRead(){
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
err=false;
do{
System.out.flush();
try{st=in.readLine();}
catch(IOException e){System.out.println(e);System.exit(1);}
if(st.length()==0)err=true;
else try{return Float.valueOf(st).floatValue();}
catch(NumberFormatExcption e){System.out.println(e);
System.out.println("请重新输入一个浮点数");err=true;}
}while(err);
return Float.valueOf(st).floatValue();
}
}
dos中出现了11个错误,那些问题说了什么问题啊?
dos中的提示如下:
C:\Javap\myJava> javac InputData.java
InputData.java:14: incompatible types
found : boolean
required: java.lang.String
err=false;
^
InputData.java:19: incompatible types
found : boolean
required: java.lang.String
if(st.length()==0)err=true;
^
InputData.java:20: cannot find symbol
symbol : variable lnteger
location: class myJava.InputData
else try{return lnteger.valueOf(st).intValue();}
^
InputData.java:21: cannot find symbol
symbol : class NumberFormatExcption
location: class myJava.InputData
catch(NumberFormatExcption e){System.out.println(e);
^
InputData.java:22: incompatible types
found : boolean
required: java.lang.String
System.out.print("请输入一个整数");err=true;}
^
InputData.java:23: incompatible types
found : java.lang.String
required: boolean
}while(err);
^
InputData.java:28: incompatible types
found : boolean
required: java.lang.String
err=false;
^
InputData.java:33: incompatible types
found : boolean
required: java.lang.String
if(st.length()==0)err=true;
^
InputData.java:35: cannot find symbol
symbol : class NumberFormatExcption
location: class myJava.InputData
catch(NumberFormatExcption e){System.out.println(e);
^
InputData.java:36: incompatible types
found : boolean
required: java.lang.String
System.out.println("请重新输入一个浮点数");err=true;
}
^
InputData.java:37: incompatible types
found : java.lang.String
required: boolean
}while(err);
^
11 errors