This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it a compile time error or runtime error?

 
Sudhakar Reddy Kurakula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
manish jha
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is runtime error.
Because syntax wise the argument is of type String. It is syntactically passing String.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic