java网络编程精解demo1---读取用户控制台的输入的数据并显示

package test3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader; public class EchoPlayer {
public static String echo(String msg){
return "echo:"+msg;
}
public void talk() throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String msg=null;
while((msg=br.readLine())!=null){
System.out.println(echo(msg));
if(msg.equals("bye")){
break;
}
}
}
public static void main(String[] args) throws IOException {
new EchoPlayer().talk();
} }

  

上一篇:SQL——字符串处理函数


下一篇:一个不错的架构图:基于SpringCloud的微服务项目