Importing classes from separate files

In the nyethack code, Game.kt finds the player class in Player.kt without any need to designate where it comes from (no need to import file). How does this work? Does the compiler parse the whole source for class declarations? What are the rules and best practices for when you need to and when you don’t need an import?

Thanks for the great content. As someone coming with javascript and rails experience and zero java experience, so far the book has been great at promoting understanding!

Hi @CBedzz,

https://www.tutorialspoint.com/java/java_packages.htm

“Classes in the same package find each other without any special syntax.”

In this case, Game.kt and Player.kt are in the same package.