(1)用Class.forName("类名").newInstance()动态创建对象
(2)用Integer.parseInt(String)从字符串中获得整数值

解决方案 »

  1.   

    String strValue = "25";
    Integer intObj = new Integer(strValue);
      

  2.   

    public static void main(String[] args) throws Exception{
    String strType="java.lang.Integer",strValue="25";
    Class cls=Class.forName(strType);
    java.lang.reflect.Constructor cst=cls.getConstructor(new Class[]{String.class});
    Object obj=cst.newInstance(new Object[]{strValue});
    System.out.println(obj);
    }
      

  3.   

    stop !已得高人指点,强人多压,可惜不再csdn上
      

  4.   

    抱歉抱歉,没看到 flyforlove(为情飞) 的回复,我还以为没人理我呢。方法可行。