Java String trim() 方法示例 Java String charAt() 方法 Java String toUpperCase() 方法示例 Java String trim() 方法示例 import java.lang.*; public class StringDemo { public static void main(String[] args) { // string with leading and trailing white space String str = " This is codingdict "; System.out.print("Before trim = "); System.out.println(".." + str + ".."); // leading and trailing white space removed System.out.print("After trim = "); System.out.println(".." + str.trim() + ".."); } } Java String charAt() 方法 Java String toUpperCase() 方法示例