Java Example – Convert string from lowercase to uppercase
The following example uses the String toUpperCase() method to convert a string from lowercase to uppercase:
StringToUpperCaseEmp.java file
public
class
StringToUpperCaseEmp
{
public
static
void
main
(
String
[
]
args
)
{
String
str
=
"
string runoob
"
;
String
strUpper
=
str
.
toUpperCase
(
)
;
System
.
out
.
println
(
"
Original string:
"
str
)
;
System
.
out
.
println
(
"
Converted to uppercase:
"
strUpper
)
;
}
}
The output of the above code example is:
原始字符串: string runoob
转换为大写: STRING RUNOOB
Java Examples