刚开始学Kotlin,有时候会有一些笔误导致的Bug,随笔记录一下。
因为少了一个括号报错“Kotlin: Classifier 'Demo1' does not have a companion object, and thus must be initialized here”
括号补上之后就可以运行了,应该是因为调用类的时候跟调用常规函数一样,都是类名/函数名+货号
刚开始学Kotlin,有时候会有一些笔误导致的Bug,随笔记录一下。
因为少了一个括号报错“Kotlin: Classifier 'Demo1' does not have a companion object, and thus must be initialized here”
括号补上之后就可以运行了,应该是因为调用类的时候跟调用常规函数一样,都是类名/函数名+货号