InterviewSolution
Saved Bookmarks
| 1. |
How Scala defines the getter-setter methods for a field in a class? |
|
Answer» Scala automatically GENERATES getter-setter METHODS for each field DEFINED in a class after compilation. If there is a field as, value:Int the getter-setter methods for this field would be, def value:Int = this.value // Getter def value_= (value:Int) = this.value = value // Setter
|
|