How to get a Java Class Object
Written on January 19, 2010 at 6:19 am by
mkyong
As far as i know, there are 4 ways to get the Java Class object.
1. “.class”
Class cls = Address.class;
2. object.getClass()
Address address = new Address(); Class cls = address.getClass();
3. Class.forName()
Class cls = Class.forName("com.mkyong.io.Address");
4. ClassLoader.loadClass()
ClassLoader cl = ClassLoader.getSystemClassLoader(); Class cls = cl.loadClass("com.mkyong.io.Address");
Oracle Magazine (Free)
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world\'s largest enterprise software company.
Publisher : Oracle Corporation


