【发布时间】:2021-01-28 12:39:39
【问题描述】:
如何在 Kotlin 中执行这种类型的转换:
public class DummyStatic {
static String Aloha;
static {
if(true) {
Aloha = "Hello";
} else {
Aloha= "Bye";
}
}
}
我尝试使用 Companion 对象和 Object 来完成这个,但无法实现所需的概念。
【问题讨论】: