title: Why do i get an error for (top method and isempty method) saying cannot find symbol?
body: <p>I wrote this code but I am getting error on <strong>isEmpty</strong> method saying cannot find symbol?</p>
  
  <pre><code>import java.io.*;
  import java.util.Scanner;
  public class ITDLinkedStack{
  
  public int peek() 
  { 
   if (isEmpty()) // this is where i get the error
   throw new RuntimeException("Peek attempted on empty stack");
   else
  return top.data;
  
  }
  
     }
  </code></pre>