System.in的用法


方法1

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner scanner=new Scanner(System.in);
String inputStr=null;

try {
// while ((inputStr = br.readLine())!=null) {
while ((inputStr = scanner.next())!=null) {
mychat.sendMessage(inputStr);
}
}catch (Exception ex){}



方法2: while(true);
方法3:object.wait ( 获取锁后)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM