newIncetance()怎样可以实例化带参数的构造器? 反射这块还是不太清楚? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://topic.csdn.net/u/20080404/10/fd572e31-24bf-4472-b994-66ed1636ba3b.html78楼我有例子。 Java codepublic class TestClass { private int testInteger; private String testString; public TestClass(Integer testInt, String testStr) { this.testInteger = testInt.intValue(); this.testString = testStr; }}...try { Class classTestClass = Class.forName("TestClass"); Class[] types = new Class[] {Integer.class, String.class}; Constructor constructor = classTestClass.getConstructor(types); Object[] args = new Object[] {123, "abc"}; Object testClass = constructor.newInstance(args);} catch (Exception e) { e.printStackTrace();} struts2的退出退出登录的按钮怎么做? FileWiter 写入文本不能换行 哪位高手帮帮小弟,一个随机生成不同数字的问题!!!!!急用!!!!! 关于GridLayout中对象的放置 求助,在dos中出了11个错误,不知错了什么? JAVA练习 请教:如何对动态gif图片进行压缩啊? help 请教number类型的存储 求援:关于DB2 JDBC连接的一段代码,一定帮我看看!!! 关于监听生成文本框的问题~ 请教一个关于继承的问题
private int testInteger;
private String testString;
public TestClass(Integer testInt, String testStr) {
this.testInteger = testInt.intValue();
this.testString = testStr;
}
}...try {
Class classTestClass = Class.forName("TestClass");
Class[] types = new Class[] {Integer.class, String.class};
Constructor constructor = classTestClass.getConstructor(types);
Object[] args = new Object[] {123, "abc"};
Object testClass = constructor.newInstance(args);
} catch (Exception e) {
e.printStackTrace();
}