Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Joel Elliott   on Oct 10 In Java Category.

  
Question Answered By: Earl Stone   on Oct 10

> assigned the value returned by Class.forName() to a
> variable, the method actually initializes a Class(in
> the parameter), so he can refer the class  further to
> create a Connection by using DriverManager...

I see, I wasn't aware of this technique.

> somebody plz tell me is it the "import" keyword
> related to "Class.forName()" method, becauz it's
> looking like these two methods doing the same thing
> (Im not sure)..

It definitely can't have to do with the import statements in the file.
That only applies to classes  that are used directly, e.g. you need
'import java.util.Vector;' if you want to write  'Vector v = new
Vector();' The argument of Class.forName has to be fully stated, e.g.
'Class.forName("java.util.Vector");' even if you specified 'import
java.util.Vector;'

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Calling classes Or get search suggestion and latest updates.


Tagged: