Using the following code fragment, Choose the correct statement which solves the error?
class A(n: Int) { var value = n } class B(n: Int) { val value = new A(n) } object Test { class A(n: Int) { var value = n } class B(n: Int) { val value = new A(n) } object Main extends App { val x = new B(5) x.value = 6 } When complied produces the following error Main.scala:7: error: reassignment to val x.value = 6 ^
Correct Answer: x.value.value = 6
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More Scala MCQ Questions