From the course: Build Spring Boot Apps with the Kotlin Programming Language

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Project structure and packages

Project structure and packages

- [Instructor] Hello, welcome to chapter six. In this chapter we're going to be creating classes in Kotlin. Before we start doing that, I'd just like to touch on project structure. In JAVA, we structure our code as follows. We first create packages and then we build classes within those packages. From a file and folder viewpoint, the packages represent folders on our drive, and the classes are, well it's one file per class. In Kotlin, we're not quite so restricted as this. First of all, the package name doesn't need to match the folder name. Now by default the ID will create exactly the same structure as we're used to seeing in JAVA, so there's no good reason not to use the structure, but I wanted to point out that Kotlin doesn't require this strict mapping between package names and folder names. What that means is that if you've defined class two within a particular package, and you want to change the package name at the declaration at the top of that file, within Kotlin you can do…

Contents