MCQs > IT & Programming > Scala > Choose the best statement to describe this error?

Scala MCQs

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) ^

Answer

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

Scala Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Scala Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it