Convert to Uppercase in Java: Explanation & Practice
Convert a string to uppercase
Problem summary
Convert 'hello world' to uppercase.
Starter code
public class Main {
public static void main(String[] args) {
String text = "hello world";
// Convert and print uppercase
}
}Expected output and test cases
- Uppercase conversion
HELLO WORLD
Hints
- Use .toUpperCase() method
- Returns a new string
- Original string is unchanged
Related Strings exercises
Practice all Strings exercises · Run this idea in the Java compiler