2008年10月3日 星期五

Lab Keyboard Input


星期五, 十月 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 則留言:

C#小技巧

1.輸入mbox之後,再連續案兩次tab鍵,會自動產生messagebox.show("test");
2.區塊註解Ctrl + K + C, 區塊取消註解Ctrl + K + U