Java syntax lacks the concept of default parameters.
The closet thing is Using Builder Pattern which we will see more about this in Named Parameters.
def renderShape(resolution: Int, details: Boolean = false, out: java.io.OutputStream = System.out): Unit
val shape = Shape(color = Color.black, name = "Circle", size = 42)
shape.renderShape(2048) // Use defaults for second and third params
shape.renderShape(resolution = 1024) // Named param + Default Param
shape.renderShape(resolution = 1024, details = true) // Default param only for third parameter
Default parameters work for any function defined, as well as for Case Classes.
Always put parameters with default values at the end at definition-site.