In this chapter, we’ll have a look at the following:
- 1.Creating classes.
- 2.How Scala makes things easier when defining fields.
- 3.What happens behind the scenes when Scala creates methods for you.
Creating Classes
Creating a class
in Java means writing something like this:
// java
public class Customer {
}
It makes sense for us to have a name and address for a customer. So, adding these as fields and initializing via the constructor would give us something like this:
// java
public class Customer {
private final String name;
private final String address;
public Customer(String ...