val a=new String("Hello")和之间有什么区别val a="Hello"
例:
val a="Hello"
val b="Hello"
a eq b
res:Boolean=True
Run Code Online (Sandbox Code Playgroud)
同理:
val a=new String("Hello")
val b=new string("Hello")
a eq b
res:Bolean=False
Run Code Online (Sandbox Code Playgroud) scala ×1