I'm trying to write a program that reads a word and prints whether
-it ends with the letter y.
-has the same first and last character, ignoring case.
This is what I have so far, but I'm having trouble thinking of a line of code that will check individual letters or compare the first and last letters.
if (. . .)
{
System.out.println(word + " ends in a y");
}
if (. . .)
{
System.out.println(word + " starts and ends with the same letter");
}
Aucun commentaire:
Enregistrer un commentaire