Java在命令行界面中进行输入数据的方法
How to input your personal data from the default command interface.
It used the System.in.read, contrast to the System.out.print.
- package com.han;
- import Java.io.*;
- /**
- * How to input your personal data from the default command interface.
- * <p>
- * It used the System.in.read, contrast to the System.out.print.
- * @author han
- *
- */
- public class InputSystem{
- public static void main(String args[]){
- byte[] buffer=new byte[512];
- try {
- System.out.print("请你输入: ");
- System.in.read(buffer);//input your data, and ends with a "Return" key.
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- String str=new String(buffer);
- System.out.println("what you input is : "+str);
- }
- }
相关推荐
IT之家 2020-03-11
graseed 2020-10-28
zbkyumlei 2020-10-12
SXIAOYI 2020-09-16
jinhao 2020-09-07
impress 2020-08-26
liuqipao 2020-07-07
淡风wisdon大大 2020-06-06
yoohsummer 2020-06-01
chenjia00 2020-05-29
baike 2020-05-19
扭来不叫牛奶 2020-05-08
hxmilyy 2020-05-11
黎豆子 2020-05-07
xiongweiwei00 2020-04-29
Cypress 2020-04-25
冰蝶 2020-04-20