title: First and Last Character of a String
body: <p>This lab we are doing in class is giving me a lot of trouble, and I wanted someone to help explain it to me. My teacher is out of town this weekend and so he can't answer my questions. The point of this lab is to find the first and last letter of each string. We also have to use "return" methods, but I am confused as to how they should be used. I know that I have to use "charAt();", but i'm not sure where to put this and how to test certain strings from another method.</p>
  
  <pre><code>import static java.lang.System.*;
  
  public class firstandlast
  {
      public String s, word, getFirst, getLast;
  
      public firstandlast(String s)
      {
      }
  
      public void setString(String s)
      {
      }
  
      public String getFirst()
      {
          return "";
      }
  
      public String getLast()
      {
          return "";
      }
  
      public String toString()
      {
          String output = "";
          return output;
      }
  }
  </code></pre>
  
  <p>Code that tests the main class:</p>
  
  <pre><code>import static java.lang.System.*;
  
  public class firstrunner
  {
      public static void main ( String[] args )
      {
          firstandlast demo = new firstandlast("Hello");
          demo.setString("Hello");
          System.out.println( "first letter :: " + demo.getFirst() );
          System.out.println( "last letter :: " + demo.getLast() );
  
          demo.setString("World");
          System.out.println( "first letter :: " + demo.getFirst() );
          System.out.println( "last letter :: " + demo.getLast() );
  
          //add more test cases   
  
      }
  }
  </code></pre>
  
  <p>I appreciate any help!</p>