| 
 
| private static void changeStringValue(Object obj) throws Exception { Field[] fields = obj.getClass().getFields();
 for(Field field : fields){
 
 if(field.getType() == String.class){
 String oldValue = (String)field.get(obj);
 String newValue = oldValue.replace('b', 'a');
 field.set(obj, newValue);
 }
 }
 在反射中进行比较字节码文件时为什么要用==,而不用equals  “ if(field.getType() == String.class)” ,为什么要比较String.class,不直接用String进行比较,这样不是更简单一些吗?
 
 
 | 
 |