For the code below, Choose the best statement to describe this error?
class A(n: Int) { var value = n } class B(n: Int) { val value = new A(n) } object Test { def main(args: Array[String]) { val x = new B(5) x = new B(6) } } Main.scala:7: error: reassignment to val x = new B(6) ^
Correct Answer: I can not replace the object created on the line above B(6) with this new one.
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More Scala MCQ Questions