【发布时间】:2016-07-21 19:09:58
【问题描述】:
我正在尝试使用动态绑定来创建“ByteCode”对象。我在下面使用此语句,但我对路径的外观感到困惑。
在 netbeans 中,我有一个名为 interpreter 的项目和一个包含 ByteCode 子类的 java 包 bytecode。
我猜它应该是("interpreter/bytecode." ),但不确定。
谢谢
bytecode = (ByteCode)(Class.forName("path/exampl/path."+codeClass).newInstance());
【问题讨论】:
-
看起来您不需要任何路径:link。只需
package.classname。