Help get this topic noticed by sharing it on Twitter, Facebook, or email.

println(a.toString())

having this code from chapter 8 from Learning Scala:

scala> class A {
| def hi = "Hello from A"
| override def toString = getClass.getName
| }
defined class A

scala> val a = new A()
a: A = A

scala> a.toString
res10: String = A

scala> println(a.toString)
$line31.$read$$iw$$iw$A

scala> println(a.toString())
$line31.$read$$iw$$iw$A

Why "println(a.toString)" is not printing "A" as in res10 ?
1 person has
this question
+1
Reply