title: Print exception error message to console
body: <p>I am struggling to print an error message to the console when calling the getCurrent() method within my print() method. Also, in my getCurrent() method the compiler says i need to return a double. I don't understand the return double problem, shouldn't the try catch block wrap around the call to getCurrent().</p>
  
  <p>getCurrent method:</p>
  
  <pre><code>    public double getCurrent() throws IllegalStateException{
      //check if element
      try{
          if(isCurrent() == true){
              return data[cursor];
          }else{
              throw new IllegalStateException
              ("No Element");
          }//end check        
      }//end try
      catch(IllegalStateException e){
          //print error message to console
          System.out.println(e.getMessage());
      }//end catch        
  }//end method
  </code></pre>
  
  <p>isCurrent() method:</p>
  
  <pre><code>    public boolean isCurrent(){
      if(cursor &lt; manyItems){
          return true;
      }else{
      return false;
      }
  }//end method
  </code></pre>
  
  <p>print() method:</p>
  
  <pre><code>    public void print(){
      double answer;
      System.out.println(" Capacity = " + data.length);
      System.out.println(" Length = " + manyItems);
      System.out.println(" Current Element = " + getCurrent());
      System.out.print("Elements: ");
      for(int i = 0; i &lt; manyItems; i++){
          answer = data[i];
          System.out.print(answer + " ");
      }//end loop
      System.out.println(" ");
  }//end method
  </code></pre>
  
  <p>main method (can't be adjusted):</p>
  
  <pre><code>  DoubleArraySeq x = new DoubleArraySeq();
    System.out.println("sequence x is empty");
    x.print();
    System.out.println("Trying to get anything from x causes an exception\n");
    System.out.printf("%5.2f", x.getCurrent());
  </code></pre>
  
  <p>Correct output:</p>
  
  <p>sequence x is empty</p>
  
  <p>capacity = 10</p>
  
  <p>length = 0</p>
  
  <p>No Element</p>
  
  <p>elements: </p>
  
  <p>Trying to get anything from x causes an exception</p>