permaculture playing cards*
The moose likes JDBC and the fly likes is it a compile time error or runtime error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "is it a compile time error or runtime error?" Watch "is it a compile time error or runtime error?" New topic
Author

is it a compile time error or runtime error?

Sudhakar Reddy Kurakula
Ranch Hand

Joined: Aug 19, 2006
Posts: 42
see this,

class.forName("driver class name");

if the driver class is not found,whether it gives compile time error or runtime error?


Cheers
Sudhakar
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

This is one of those questions where you might be quicker trying it yourself and seeing what happens.

If you read the JavaDocs for the forName(String) method of Class you'll see it throws a ClassNotFoundException if the class can't be found. However it takes a String, so it can only be at runtime the ClassLoader tries to load this.
[ December 11, 2006: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
manish jha
Greenhorn

Joined: Dec 09, 2006
Posts: 7
it is runtime error.
Because syntax wise the argument is of type String. It is syntactically passing String.


Manish<br />SCJP 1.4<br />SCWCD<br />WebSphere Portal Developer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is it a compile time error or runtime error?