0

此代码始终返回 true 可以请帮助我

public boolean plselct(String sqd)
    {
     try{
         String player  ;

         pm = conn.prepareStatement("SELECT playertype FROM playerdetails where idplayeratrr = ?");

         pm.setString(1,sqd );
         h= pm.executeQuery();

         player = h.getString("playertype");

         if ("Goal keeper".equals(player))
         { return true; }
         else 
           return false;

       }catch (Exception e)
        {}
    return false;
}

SelectQu p = new SelectQu();
p.plselct("77");

if(true)
{ System.out.println("Yes"); }
else 
{ System.out.println("No"); }
4

1 回答 1

0

你在检查if(true)吗?你是不是这个意思:

SelectQu p = new SelectQu();

if(p.plselct("77"))
{ 
     System.out.println("Yes"); 
}
else 
{ 
    System.out.println("No"); 
}
于 2013-04-02T03:31:50.837 回答