java键盘录入

System.out:标准输出设备(默认是:控制台)

System.in:标准输入设备(默认是:键盘)

---------------------

InputStream in = System.in;

int by = in.read();

sysout(by);

---------------------

InputStream in = System.in;

StringBuilder sb = new StringBuilder();

while(true){

int ch = in.read();

if(ch==’\r’){

continue;

}

if(ch==’\n’){

String s = sb.toString();

if(“over”.equals(s)){

break;

}

System.out.prinltn(s.toUpperCase());

sb.delete(0, sb.length());

}

else

sb.append((char)ch);

}

上一篇:Mesos+Zookeeper+Marathon+Docker分布式集群管理最佳实践


下一篇:My First Marathon【我的第一次马拉松】