java 读取控制台(console)输入:

package com.company;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {


        Scanner scanner = new Scanner(System.in);
        System.out.println("your name:");

        String name =scanner.nextLine();
        System.out.println("name is :"+name);
    }
}

 

你可能感兴趣的