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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -