aspose file tools
The moose likes BEA/Weblogic and the fly likes Re:Class.forName() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Reply Bookmark "Re:Class.forName()" Watch "Re:Class.forName()" New topic
Author

Re:Class.forName()

Sujith Kanaparthi
Ranch Hand

Joined: Sep 04, 2005
Posts: 45
Hi ,

I have a query.The function forName(String className) of java.lang.Class returns class object associated with the given string.Every return type must be caught.But if I write a programm such as


public class Demo{
public static void main(String arg[]){
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//this function returns class object
/* code to manipulate database */


}
}

Eventhough I have not caught the returned class object,like Class m = Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")), the program is working fine.I just want to know how is this possible and why is this happening?.Please clarify my doubt.

Regards,
Sujith
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Please don't cross post.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Re:Class.forName()
 
Similar Threads
uncomfortable syntax
Context param values from web.xml
Re:Class.forName()
package sun.jdbc does not exist
Typecasting to a dynamic class