B {
}
}
在 类 A 中调用 B , 可以直接使用 B() 进行调用 ;
在 外部调用 类 B 时 , 可以使用 A.B() 的形式进行调用 ;
在 Java 中内部类有 成员内部类 , 静态嵌套类..., 方法内部类 , 匿名内部类 几种类型 ;
Kotlin 嵌套类 , 相当于 Java 中的 静态嵌套类 ;
代码示例 : 在下面的代码中 , 在 Person 类内部中定义 Student 嵌套类...选择 Show Kotlin Bytecode 选项 ,
在 Kotlin Bytecode 界面 中 , 选择 Decompile 选项 , 将 字节码数据 反编译为 Java 代码数据 ,...发现 Kotlin 编译器 为 Student 数据类 自动生成了一个 toString 方法 , 将其数据打印出来 ;
同时还 重写 Student 数据类 中的 equals 和 hashCode...编译器在编译时自动给数据类添加上了结构声明 ;
@NotNull
public final String component1() {
return this.name;