201803100219『Java』利用BufferedReader獲得輸入@生涯狂想

簡體中文翻譯英語import java.io.*;
public class BufferedReaderDemo {
    public static void main(String[] args) throws IOException {
        BufferedReader keyin =
                          new BufferedReader(
                             new InputStreamReader(System.in));
        System.out.print("請輸入一列文字,可包括空白: ");
        String text = keyin.readLine();
        System.out.println("您輸入的文字: " + text);
    }
}
 利用BufferedReader 獲得輸入一個整數iNum 和一個浮點數 fNum翻譯
import java.io.*; 
public class InputNum
{
public static void main(String[] args)  throws java.io.IOException
{
BufferedReader keyin
        = new java.io.BufferedReader(
           new java.io.InputStreamReader(System.in));
System.out.print("請輸入整數: ");
int iNum = Integer.parseInt(keyin.readLine());
System.out.println("輸入的整數: " + iNum);
System.out.print("請輸入浮點數: ");
float fNum = Float.parseFloat(keyin.readLine());
System.out.println("輸入的浮點數: " + fNum);
}
}


文章出自: http://blog.xuite.net/sky1208227/pen/8816748-%E3%80%8EJava%E3%80%8F%E4%BD%BF%E7%94%A8+BufferedReader有關各國語文翻譯公證的問題歡迎諮詢天成翻譯公司02-77260931
沒有上一則|日誌首頁|沒有下一則
回應
關鍵字
[此功能已終止服務]
    沒有新回應!





Powered by Xuite