import java.net.*;
import java.io.*;
class LoginClient
{
public static void main(String[]args)throws Exception
{
Socket st=new Socket("192.168.0.2",10002);
try{
PrintWriter out=new PrintWriter(st.getOutputStream(),true);
BufferedReader bur=new BufferedReader(new InputStreamReader(System.in));
BufferedReader buw=new BufferedReader(new InputStreamReader(st.getInputStream()));
for(int i=0;i<3;i++)
{
String name=bur.readLine();
if(name==null)
{
System.out.println("请输入用户名");
continue;
}
out.println(name);
String line=buw.readLine();
System.out.println(line);
if(line.contains("欢迎"))
break;
}
}
catch(IOException e){e.printStackTrace();}
finally{
try{
bur.close();
st.close();
}
catch(IOException e){e.printStackTrace();}
}
}
}
上面代码编译时出现问题
说变量bur找不到
编译提示找不到bur!!!!!!!!!!!
是不是说明try中的变量在try外面不能用
|
|