title: Java excel: How to compare two cells
body: <p>I'm looking to see for each row if the value of column 1 is the same or different I've tried adding .getContents() to the end of cell and sheet but it doesn't change the result and tried converting them both to strings but still same result. Every time I've tried it keeps returning "do action 2"</p>
  
  <p>I'm also using JExcelAPI</p>
  
  <pre><code>w = Workbook.getWorkbook(inputWorkbook);
  Sheet sheet = w.getSheet(0);
  for(int i = 1;i&lt;sheet.getRows(); i++){ 
                   Cell cell = sheet.getCell(0,i);
                   if(cell == sheet.getCell(0, (i+1))){ //If cell is the same value as the one in the row below it
                       //do action 1
                   }
                   else if(cell != sheet.getCell(0,(i+1))){//If cell has a different value as the one in the row below it
                   //do action 2
                   }
               }
  </code></pre>