Default values are a powerful feature of Kotlin. They allow us to write fewer overloaded functions and can even help us replace the builder pattern. Unfortunately, we can't leverage this feature from Java. Because of this, we have to think carefully about how to write functions if they will be used from both Kotlin and Java. If a class written in Kotlin will be used from Java, you may have to consider whether or not you can make heavy use of default values.
To help make this decision, we can consider making use of the @JvmOverloads annotation to generate Java method overloads, which will make use of our defined default values.
In this snippet, we've defined a class, Student, that includes a primary constructor. This constructor includes four properties that all contain a default value:
class Student(
val firstName:String = "...