Read Time:20 Second
Write a program to check if the letter ‘e’ is present in the word ‘Umbrella’
public class CheckLetterExample { public static void main(String[] args) { String word = "Umbrella"; boolean containsE = word.contains("e"); if (containsE) { System.out.println("The word " + word + " contains the letter 'e'"); } else { System.out.println("The word " + word + " does not contain the letter 'e'"); } } }
Output:
The word Umbrella contains the letter 'e'
Average Rating