EN
Java - convert string to uppercase
0 points
In this article, we would like to show you how to convert string to uppercase in Java.
Quick solution:
xxxxxxxxxx
1
String text = "abcd";
2
3
String textUpper = text.toUpperCase();
4
5
System.out.println(textUpper); // ABCD
In this example, we use String.toUpperCase()
method to convert the text
string to uppercase.
xxxxxxxxxx
1
public class Example {
2
3
public static void main(String[] args) {
4
String text = "abcd";
5
6
// convert text to uppercase
7
String textUpper = text.toUpperCase();
8
9
System.out.println(textUpper); // ABCD
10
}
11
}
Output:
xxxxxxxxxx
1
ABCD