public void optField() {
		Class<?> clazz;
		try {
			clazz = Class.forName("com.rock.reflect.User");
			User u = (User) clazz.newInstance();
			Field f = clazz.getDeclaredField("userName");
			f.setAccessible(true);//设置为true后，可访问私有变量
			System.out.println(f);
			f.set(u, "rock");		
			System.out.println(u.getUserName());
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (NoSuchFieldException e) {
			e.printStackTrace();
		} catch (SecurityException e) {
			e.printStackTrace();
		}
	
	}