2019年4月3日 星期三

[JAVA] System.in 輸入

[JAVA] System.in 輸入

import java.util.Scanner;

public class HelloUser {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Please input a number: ");
        System.out.printf("Oh! I get %d!!", scanner.nextInt());
    }
}

stdin
10099

輸出畫面
Please input a number: Oh! I get 10099!!


沒有留言:

張貼留言

WOKWI LED + MQTT Node-Red SQLite

WOKWI LED + MQTT Node-Red SQLite const char *mqtt_broker = "broker.mqtt-dashboard.com" ; const char *topic1 = "alex9ufo/e...