[英]I get an error when i try to run my first kotlin code in intellij idea community version 2021.2
[英]Why I am unable to run my old Kotlin program in new version of IntelliJ Idea?
使用 Kotlin 1.4 和 jdk 14,此代码可在 IntelliJ 中运行
class DogClass(private val id: Int, private val color: String) {
fun bark() = println("$color dog $id barks")
}
class Cat(private val id: Int, private val color: String) {
fun meov() = println("$color cat $id says meow")
}
fun main() {
val dog1 = DogClass(4, "Black")
dog1.bark()
val cat1 = Cat(4, "White")
cat1.meov()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.