for(int x=0;x<3;x++)
{
BufferedReader br=new BufferedReader(new InputStreamReader(s.getInputStream()));
String name=br.readLine();
if(name==null)
break;
PrintWriter pw=new PrintWriter(s.getOutputStream(),true);
BufferedReader buff=new BufferedReader(new FileReader("user.txt"));
String line=null;
boolean flag=false;
while((line=buff.readLine())!=null)
{
if(line.equals(name))
{
flag=true;
break;
}
}
if(flag)
{
System.out.println(name+",已登录");
pw.println(name+"欢迎光临");
break;
}
else
{
System.out.println(name+",正在尝试登录");
pw.println(name+"用户名不存在");
}
这个程序中的标记flag有点晕,哪位大神帮忙解答一下 |