package com.atguigu.test;
import java.lang.reflect.Field;
public class Test03 {
public static void main(String[] args) throws Exception {
// 不可变字符串
// trim方法只能去掉半角空格
String s = " a b ";
//反射
// Class c = String.class;
// Field f = c.getDeclaredField("value");
// f.setAccessible(true);
// char[] cs = (char[])f.get(s);
// cs[2] = '1';
s = s.trim();
System.out.println( "!"+s+"!" );
}
}
trim(用于去半角空格(英文))
猜你喜欢
转载自blog.csdn.net/mingxu_W/article/details/83929829
今日推荐
周排行