Thursday, 15 August 2013

java - Query on instance of Class class -



java - Query on instance of Class class -

every object in java belongs class. that's why object class, inherited other classes, defines getclass().

getclass() method returns instance of class class.

for example:

class foo{} class sample{ class foo instance = foo(); class obj = instance.getclass(); }

another way of getting instance of class class saying foo.class

my question:

i can see definition of getclass() in object class source code(file object.java bundle java.lang). in source file, can see fellow member class using foo.class?

no source file. class keyword (like this, instanceof, etc), not fellow member of class, , handled compiler, not in code.

java class

No comments:

Post a Comment