title: Incompatible types: java.lang.String cannot be converted to boolean
body: <p>I am trying to call a method within an if statement but I keep getting the following error. </p>
  
  <blockquote>
    <p>incompatible types: java.lang.String cannot be converted to boolean</p>
  </blockquote>
  
  <p>When you run the getName method it should check the barcode the user enters and if it matches, it will return a String.</p>
  
  <p>This is the class and method I am doing the method call.</p>
  
  <pre><code>public class ItemTable
  
     public String getName (Item x)
     {
      String name = null;
  
      if (x.getBarcode ("00001")) 
          name = "Bread";
  
      return name;
     }
  </code></pre>
  
  <p>This is the method/class I am calling from.</p>
  
  <pre><code>public class Item
  
  private String barcode;
  
  public Item (String pBarcode)
  {
      barcode = pBarcode;
  }
  
  public String getBarcode (String barcode)
  {
      return barcode;
  }
  </code></pre>