Getting a Class Name


Class c = someObject.getClass(); String s = c.getName();



Getting the name of a Class object is an easy task. You get the class name of any Class object using the getName() method. The String returned by the getName() method will be the fully qualified class name. So for example, if in this phrase, the someObject variable is an instance of the String class, the name returned from the call to getName() will be

java.lang.String





JavaT Phrasebook. Essential Code and Commands
Java Phrasebook
ISBN: 0672329077
EAN: 2147483647
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net