求助!servlet比较两个字符串是否相等
//得到表单提交的值String receiveUname=request.getParameter("sendName");
String message=request.getParameter("message");
String note=request.getParameter("note");
HttpSession session=request.getSession();
String userName=(String)session.getAttribute("userName");
UserinfoDAO udao=new UserinfoDAO();
//从数据库中查出数据
ArrayList list=udao.findAll();
//for循环比较和当前字符串是否相等
for(int i=0;i<list.size();i++){
Userinfo uf=(Userinfo)list.get(i);
if(receiveUname.equals(uf.getUserName()));
{
MessageinfoDAO mdao=new MessageinfoDAO();
int count=mdao.sendMessage(note, userName, receiveUname, message);
if(count>0){
System.out.print("发送成功!");
response.sendRedirect("/shortmessage1/index.jsp");
break;
}
}
//请问为执行这段代码receiveUname和uf.getUserName()总是相等的,控制台总是提示发送成功!该怎么判断这两个值是否相等,用什么方法