Взимане на Java клас обект


Ще ви представя , четири начина за взимане на обект в java class.

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");

Popularity: 1% [?]

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

You can leave a response, or trackback from your own site.

Leave a Reply

Задвижван с помощта на WordPress | Compare Cell Phone Plans at iCellPhonePlans.com | Thanks to Cheap Palm Pixi, Bromoney and Wordpress Themes