星期五, 十月 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
1 則留言:
笨蛋
張貼留言