加入收藏 | 设为首页 | 会员中心 | 我要投稿 我爱制作网_潮州站长网 (http://www.0768zz.com/)- 物联安全、建站、操作系统、云计算、数据迁移!
当前位置: 首页 > 教程 > 正文

Java在命令行界面中进行输入数据的技巧

发布时间:2021-12-18 13:27:57 所属栏目:教程 来源:互联网
导读: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. *
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);  
    }  
}   
 

(编辑:我爱制作网_潮州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读