Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

is it a compile time error or runtime error?  RSS feed

 
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
 
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 ]
 
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.
 
crispy bacon. crispy tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!