In Scala when you query an object for either its class or its class name, you'll get a rogue dollar sign ("$
") at the tail end of the printout:
val fizzbuzz : FizzBuzz = new FizzBuzz()
println(s"The class is ${fizzbuzz.getClass}")
println(s"The class name is ${fizzbuzz.getClass.getName}")
This results with:
The class is com.me.myorg.example.FizzBuzz$
The class name is com.me.myorg.example.FizzBuzz$
Sure, it's simple enough to manually remove the "$
" at the end, but I'm wondering:
- Why is it there?; and
- Is there anyway to "configure Scala" to omit it?
Aucun commentaire:
Enregistrer un commentaire