K
K
Koshkasobaka2021-04-26 21:52:38
IntelliJ IDEA
Koshkasobaka, 2021-04-26 21:52:38

Why is there a "function main is not found in class Main" error?

I configured Edit Configurations manually, but the program sees the Main class, but for some reason the method is not

package com

class Main {

     fun main(args: Array<String>) {
        println("Hello")
    }
}


60870c698bc9c731598381.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2021-04-26
@Koshkasobaka

Because it has to be static. Just remove it from the class to the global scope or put it in a companion object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question