Using .length and .charAt

We can use .length() to count the number of letters in a String.
We can use .charAt(int) to check single letters in a String.

Write a method called checkPlural(String) that
accepts a word as a parameter and checks whether
the last letter is 's' .  If so, it returns true.
If not, it returns false.

Solution

public  boolean  checkPlural(String word)
{
     int  count = word.length();    // count the letters in the String

     char  last =  word.charAt(count - 1) ;    // the last letter in word

     if ( last == 's' )
     {   return true;  }
      else
     {   return false;  }      

}