import javax.print.attribute.standard.printerinfo; interface hasbatteries{} interface waterproof{} interface shootsthings{} class toy{ toy(){} toy(int i){} } class fancytoy extends toy implements hasbatteries,waterproof,shootsthings{ public fancytoy() { // todo 自动生成的构造函数存根 super(1); } } public class toytest { public static void main(string[] args){ class class1=null; try{ class1=class1.forname(fancytoy); }catch (classnotfoundexception e) { // todo: handle exception } printinfo(class1); class[] faces=class1.getinterfaces(); for(int i=0;i
2.class对象的forname()使用时传递的类名classname参数是需要全名的,不能只加类名,比如包名.类名,java.lang.string。
import javax.print.attribute.standard.printerinfo; interface hasbatteries{} interface waterproof{} interface shootsthings{} class toy{ toy(){} toy(int i){} } class fancytoy extends toy implements hasbatteries,waterproof,shootsthings{ public fancytoy() { // todo 自动生成的构造函数存根 super(1); } } public class toytest { public static void main(string[] args){ class class1=null; try{ class1=class1.forname(fancytoy); }catch (classnotfoundexception e) { // todo: handle exception } printinfo(class1); class[] faces=class1.getinterfaces(); for(int i=0;i
以上就是java怎么在运行期间鉴定数据类型的详细内容。
