title: JAVA two equal strings return false
body: <p>I have a JTable and i need to check if the JTable has an entry equal to one in my database ( It does ) . But when i check it out, it gives me false . Both result are the same ( Cat and Cat ). </p>
  
  <pre><code>ResultSet resultset;
  try {
      // Query declaration, etc
      while(resultset.next()){
          String name = resultset.getString(1);
          int quantity = resultset.getInt(2);
          checkListQuantity(name, quantity);
          }   
  
  public void checkListQuantity(String name, int quantity){
          String string = String.format("%-40s", name);
              for(int i = 0; i &lt; table.getRowCount(); i++){
                  System.out.println("Name :"+name);
                  System.out.println("Column :"+ model.getValueAt(i, 1));
                  System.out.println(name.equals(String.valueOf(model.getValueAt(i, 1))));
              }
  
          }
  
      }
  </code></pre>