- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write a Java program to capitalize each word in the string?
You can capitalize words in a string using the toUpperCase() method of the String class. This method converts the contents of the current string to Upper case letters.
Example
public class StringToUpperCaseEmp { public static void main(String[] args) { String str = "string abc touppercase "; String strUpper = str.toUpperCase(); System.out.println("Original String: " + str); System.out.println("String changed to upper case: " + strUpper); } }
Output
Original String: string abc touppercase String changed to upper case: STRING ABC TOUPPERCASE
- Related Articles
- Java Program to Capitalize the first character of each word in a String
- Write a java program to reverse each word in string?
- Write a java program to tOGGLE each word in string?
- Golang program to capitalize first character of each word in a string
- Write a java program reverse tOGGLE each word in the string?
- How to capitalize the first letter of each word in a string using JavaScript?
- Python program to capitalize each word's first letter
- Using a recursive function to capitalize each word in an array in JavaScript
- Java program to reverse each word in a sentence
- Python Program to Capitalize repeated characters in a string
- Write a python program to count occurrences of a word in string?
- Find frequency of each word in a string in Java
- Java program to count occurrences of a word in string
- Extracting each word from a string using Regex in Java
- How to print the first character of each word in a String in Java?

Advertisements