投我尝试对象转换我的Action类,但它导致了警告:类型安全:未选中的对象
Type safety: Unchecked cast from Object to Action<ClientInterface>
Action<ClientInterface> action = null;
try {
Object o = c.newInstance();
if (o instanceof Action<?>) {
action = (Action<ClientInterface>) o;
} else {
// TODO 2 Auto-generated catch block
throw new InstantiationException();
}
[...]
感谢您的帮助
'c'的类型是什么? – meriton 2010-04-07 13:21:10
关于c的类型: 类> c = null; c = Class.forName(className); 无论如何,我有足够明确的答案!谢谢大家,是否有可能以某种方式关闭问题或将问题标记为已回答? – Matthew 2010-04-07 14:28:40
是的,使用您偏好答案左边的绿色复选标记。的 – meriton 2010-04-07 15:44:47