Class not found in module

Viewed 5885

I made a project using kotlin:

Group id-> com.programming.kotlin

Artifact id->chapter01

Module name->chapter01

package->com.programming.kotlin.chapter01

I made a kotlin class called Program.kt

The problem is: when i try to make a new class(called Program2.kt) inside package and when i try to run it ,i got this error:

class com.programming.kotlin.chapter01.Program2kt not found in module 'chapter01_main'

My question is: how to allow any new class other than Main class to run inside intellij ?

1 Answers

Your class name should be com.programming.kotlin.chapter01.Program2. If you go to InteliJ and right click on the class, you can click Copy Reference, which will copy the class reference (package and class name).

The Kt (with a capital K) is only added to functions without an enclosing class or object.

Related