Every variable and expression in a Scala program has a type that is known at compile time.
A type restricts the possible values to which a variable can refer, or an expression can produce, at run time.
A variable or expression’s type can also be referred to as:
In other words, “type” by itself means static type.
Type is distinct from class because a class that takes type parameters can construct many types.
For example:
A type can have :
For example:
Some annotations are type constraints, meaning that they add additional limits, or constraints, on what values the type includes.
For example:
Type constraints are not checked by the standard Scala compiler, but must instead be checked by an extra tool or by a compiler plugin.
A class or trait that takes type parameters.
A parameter to a generic class or generic method that must be filled in by a type.
For example, the T in both cases is a type parameter.
A method’s type signature comprises:
The type signature of a class, Scala - Trait (Interface), or singleton object comprises: