Object is not a value error in scala

后端 未结 4 718
礼貌的吻别
礼貌的吻别 2020-12-18 21:14

While trying to make a map in Scala, I receive the following error message: object Map is not a value

The code I\'m using is the following:

         


        
4条回答
  •  囚心锁ツ
    2020-12-18 22:05

    Because in scala each native scala class comes with an (optional) companion object (allowing for assignment from the companion object as in your example code) when incorporating a java class into scala code always remember to instantiate the class by invoking the constructor, ie. use keyword "new", thus creating a value.

提交回复
热议问题