title: What causes the "Incompatible operand types" error?
body: <p>I am trying to implement iSortableStack Interface via a class. </p>
  
  <p>Here's my main function, </p>
  
  <pre><code>public class SampleStack&lt;E&gt; {
      E ch;
  
      @SuppressWarnings("unchecked")
      public static void main(String[] args) throws IOException {
          ISortableStack&lt;Character&gt; s = new SortableStack&lt;Character&gt;();
          SampleStack demo = new SampleStack();
          while ((demo.ch == System.in.read()) != '\n')
              if (!s.isFull())
                  s.push((Character) demo.ch);
          while (!s.isEmpty())
              System.out.print(s.pop());
          System.out.println();
      }
  }
  </code></pre>
  
  <p>But I am getting one error, on this line, </p>
  
  <pre><code>while ((demo.ch == System.in.read()) != '\n')
  </code></pre>
  
  <p><strong>Error : Incompatible operand types Object and int</strong></p>
  
  <p>What is wrong here ?</p>