This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 6.8, “How to create object instances without using the 'new' keyword.”
You’ve seen that Scala code looks cleaner when you don’t always have to use the
new keyword to create a new instance of a class, like this:
val a = Array(Person("John"), Person("Paul"))
So you want to know how to write your code to make your classes work like this.