scala> class Rectangle (Length: Int, Width: Int) {; def getLlength (): Int = println (Length); def getWidth ():Int = println (Width); }
:11: error:
The error message is telling you that println has the return type Unit, so since your getLlength method returns the result of println, it will return Unit. This is an error because you said that getLlength should have a return type of Int.
If you want your getLlength method to print the length, you probably should change its return type to Unit (and change the name to something that makes this clear).
If you want your getLlength method to return the length, your should not be calling println, but rather just return the length.