Java: Capitalize the first letter of each word in a sentence
Capitalize Each Word
Write a Java program to capitalize the first letter of each word in a sentence.
Pictorial Presentation: Capitalize the first letter of each word in a sentence
Sample Solution:
Java Code:
Sample Output:
Input a Sentence: the quick brown fox jumps over the lazy dog. The Quick Brown Fox Jumps Over The Lazy Dog.
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Java program to capitalize only the first and last letter of each word in a given sentence.
- Write a Java program to capitalize words in a sentence but leave words with fewer than four letters unchanged.
- Write a Java program to capitalize every alternate word in a given sentence.
- Write a Java program to capitalize words in a sentence only if they start with a vowel.
Go to:
PREV : Count Factors of Integer.
NEXT :
Convert to Lowercase.
Java Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.