Board logo

標題: 資料輸入 (一) [打印本頁]

作者: 許婷芳    時間: 2020-6-5 21:19     標題: 資料輸入 (一)

本帖最後由 許婷芳 於 2020-6-6 10:44 編輯

運用套件 java.io 下的 Console 類別, 作字串輸入的練習.
  1. import java.io.Console;  //java的input&output

  2. public class Ch01
  3. {
  4.     public static void main(String args[])
  5.     {
  6.          String str1,str2;
  7.          Console c=System.console();  //把所有輸入的東西放到c裡面
  8.          System.out.print("輸入字串1:");
  9.          str1=c.readLine();  //一行一行讀取
  10.          System.out.print("輸入字串2:");
  11.          str2=c.readLine();
  12.          System.out.println("字串1="+str1);
  13.          System.out.println("字串2="+str2);
  14.     }
  15. }
複製代碼

作者: 陳宇柏    時間: 2020-6-6 10:34

此帖僅作者可見
作者: 黃傳耀    時間: 2020-6-6 10:38

此帖僅作者可見
作者: 王建葦    時間: 2020-6-6 10:39

此帖僅作者可見
作者: 鄭羽捷    時間: 2020-6-6 10:41

此帖僅作者可見
作者: 蔡少宇    時間: 2020-6-6 10:42

此帖僅作者可見
作者: 王翎璇    時間: 2020-6-6 10:42

此帖僅作者可見
作者: 曾宥程    時間: 2020-6-6 10:43

此帖僅作者可見
作者: 郭哲維    時間: 2020-6-6 10:51

此帖僅作者可見
作者: 駱顗安    時間: 2021-1-20 17:18

此帖僅作者可見




歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2