title: checking if first char is equal to last char
body: <p>I'm fairly new to java and I was wondering on how to return my code to false if the 1st and last letter aren't the same</p>
  
  <p>he whole instruction was to define and test a method called checkString that will take in the word as a parameter and checks whether the String begins and ends with the same letter. If both letters are the same the method returns true otherwise false (returns a boolean). The program treats lower and uppercase letters as equivalent</p>
  
  <p>here's what I have:</p>
  
  <pre><code>    import java.util.Scanner;
      public class Excercise5 {
          public static void main(String[] arg) {
              Scanner keyboard = new Scanner(System.in);
              System.out.print("Type a string: ");
              String word = keyboard.nextLine(); 
              System.out.printf ("%s begins and ends with the same letter.", checkString(word));
          }
          public static boolean checkString (String word) {   
              int stringLength = word.length();
              String letter1 = (word.substring (0,1)).toUpperCase();
              String lastletter = (word.substring ((stringLength-1),(stringLength))).toUpperCase();
  
              if (letter1.equals(lastletter)){
                  return true;
              } else {
                  return false;
              }
          }
      }
  </code></pre>