根据Locale语言转换为对应的大写字母,如果Locale为空,则默认调用toUpperCase(Locale.getDefault())方法。
String toUpperCase - 语法
public String toUpperCase(Locale locale)
String toUpperCase - 返回值
- 它返回字符串,并转换为大写。
String toUpperCase - 示例
import java.io.*; public class Test { public static void main(String args[]) { String Str=new String("Welcome to Learnfk.com"); System.out.print("返回值 :" ); System.out.println(Str.toUpperCase() ); } }
这将产生以下输出-
返回值 :WELCOME TO LEARNFK.COM