hi, Dear grat java fellows,I have a problum.What is class class ,I think a polite person in which must be explain thsi! Kashif Hameed!
posted 12 years ago
The Class class (did you hear an echo?) is mainly used for the java reflection API. If you know the Class of an object you can learn practically everything about its class: fields, methods, constructors, etc. It also has a couple of handy methods, getResource() and getResourceAsStream(), which return URL and InputStream respectively. Those are very usefull when you have a resource in the same jar file as the object of the particular Class. You will no doubt eventually see code like:
That static method causes the ClassLoader to dynamically load the class com.mywww.DBDriver, provided of course it can locate it.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher