class1.isAssignableFrom(class2) 判定此 Class 对象所表示的类或接口与指定的 Class 参数所表示的类或接口是否相同,或是否是其超类或超接口.如果是则返回 true:否则返回 false.如果该 Class 表示一个基本类型,且指定的 Class 参数正是该 Class 对象,则该方法返回 true:否则返回 false. 1.class2是不是class1的子类或者子接口 2.Object是所有类的父类 一个例子搞定: package com.auuzee…
一般this在各类语言中都表示“调用当前函数的对象”,java中也存在这种用法: public class Leaf { int i = 0; Leaf increment(){ i++; return this; //this指代调用increment()函数的对象 } void print(){ System.out.println("i = " + i); } public static void main(String[] args) { Leaf x = new Leaf()…