java - Compile error getting class with getClass() -
i'm learning getclass
, how works.
i read that: http://docs.oracle.com/javase/7/docs/api/java/lang/object.html
but don't understand why fails:
boolean b; class c = b.getclass();
can explain me why gives me error?
boolean b;
primitive datatype , cannot invoke methods on using . operator , try boolean b
; boolean wrapper class primitive boolean
.
try this:
boolean b = null; class c = b.getclass();
or better
boolean b = null; class<? extends boolean> c = b.getclass();
Comments
Post a Comment