www.pudn.com > QingHuangDaoBus.rar > MyInput.java


//Myinput.java 
//该类用于处理整数、实数、字符串的键盘输入 
import java.io.*; 
public  class MyInput 
   { 
       //read a string from the keyboard 
       public static String readString() 
         { 
           BufferedReader br=new BufferedReader(new InputStreamReader(System.in),1); 
            //Declare and initialize the string 
           String string=" "; 
             //get the string from the keyboard 
           try 
             { 
                 string=br.readLine(); 
             } 
           catch(IOException ex) 
             { 
                System.out.println(ex); 
             } 
           return string; 
         } 
       public  static int readInt() 
         { 
            return Integer.parseInt(readString()); 
         } 
        //read a double value from the keyboard 
       public static double readDouble() 
         { 
           return Double.parseDouble(readString()); 
         } 
 
   }