public abstract class AbstractFactory { public static AbstractFactory getInstance(String classname){ AbstractFactory abs=null; try { abs=(AbstractFactory) Class.forName(classname).newIn... public abstract class AbstractFactory {
public static AbstractFactory getInstance(String classname){
AbstractFactory abs=null;
try {
abs=(AbstractFactory) Class.forName(classname).newInstance();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return abs;
}
abstract Connection getConnection();
abstract Statement getStatement();
}
运行显示abs的值是空的,如果我加上abs.getConnection().createConnection();也不会输出,求指教,哪里错了啊。没钱了,只能悬赏5个了,,
不是抛异常,而是直接是值为空么?
class.forname 要的参数是完整的路径名,不是类名