I am trying to get a class method by is name, e.g.:
case class A(i : Int) {def geti = i}
val a = A(123)
val met = a.getClass.getMethod("geti")
This seems to work, but if I try to do the same on a Double:
val a:Double = 3.0
a.getClass.getMethod("toString")
I run into this error:
java.lang.NoSuchMethodException: double.toString()
at java.lang.Class.getMethod(Class.java:1786)
Could you help me figuring out what I am missing?
Aucun commentaire:
Enregistrer un commentaire