• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

34강 리플렉션강의중에서

23.08.28 18:29 작성 조회수 204

0

class TestClass() {
constructor(a:Int) : this() {

}
constructor(a:Int, b: Int) : this() {

}
fun testMethod() {

}

}

fun main(){
val t1 : TestClass = TestClass()
println("추상클래스인지아닌지: ${t1::class.isAbstract}") // 변수명: company_name
}

답변 3

·

답변을 작성해보세요.

0

implementation "org.jetbrains.kotlin:kotlin-reflect:최신버전"

형태로 라이브러리 추가해보세용


0

shafeel2님의 프로필

shafeel2

질문자

2023.08.28

참고로 저는 Intellij 로 코딩연습하고 있습니다

0

shafeel2님의 프로필

shafeel2

질문자

2023.08.28

위코드를 실행하면 아래와 같은 에러가 발생합니다

Exception in thread "main" kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath

at kotlin.jvm.internal.ClassReference.error(ClassReference.kt:88)

at kotlin.jvm.internal.ClassReference.isAbstract(ClassReference.kt:62)

at MainKt.main(Main.kt:16)

at MainKt.main(Main.kt)