且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将用户输入字符串转换为大写Java

更新时间:2023-01-14 12:32:13

String类具有toUpperCase()方法.

The String class has a toUpperCase() method on it.

JOptionPane.showInputDialog(..)返回一个字符串,因此您可以使用:

JOptionPane.showInputDialog(..) returns a String, so you can use:

JOptionPane.showInputDialog("Enter name: ").toUpperCase();