星期五, 十月 03, 2008
Lab Keyboard Input
Rewrite Display 2.6 using BufferedReader.You need to import the following packages in the first place.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
Change
Scanner keyboard= new Scanner(System.in);
into
BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));
String inputString = keyboard.readLine();
Note the Main method needs IOException handling as follows:
public static void main (String[] args) throws IOException
笨蛋
回覆刪除