MCQs > IT & Programming > Scala > Reason why the code fails to compile, for the type hierarchy and expressions as following?

Scala MCQs

Choose the best reason why the code fails to compile, for the type hierarchy and expressions as following?

class A { } class B extends A {} class C { } class D extends C { } case class S[T <: A ](a: T*) {} val aa: S[A ] = S[( new B(), new A() ) val cc = S( new D() )

Answer

Correct Answer: In the expression "val cc = S( new D() )" The inferred type arguments [D] do not conform to apply method's type parameter bounds

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