#scala
the implicit return type Unit
corresponds to void
in Java-like languages
If you want to change selection, open document below and click on "Move attachment"
Classes - Scala Documentation+ dy
}
override def toString(): String = "(" + x + ", " + y + ")";
}
The class defines two variables x and y and two methods: move and toString. move takes two integer arguments but does not return a value (<span>the implicit return type Unit corresponds to void in Java-like languages). toString, on the other hand, does not take any parameters but returns a String value. Since toString overrides the pre-defined toString method, it has to be tagged with the override fl Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details