What does Class.forName return?

Answers were Sorted based on User's Feedback



What does Class.forName return?..

Answer / ranganathkini

The Class.forName( String name ) returns a java.lang.Class
object associated with the class or interface with the
specified fully qualified name.

Is This Answer Correct ?    17 Yes 2 No

What does Class.forName return?..

Answer / karthik

Class.forName attempts to load the class whose name is
given in its only argument, and returns the Class instance
representing that class. In the
event that the Class could not be found, resolved, verified,
or loaded, Class.forName
throws one of several different Exceptions

Is This Answer Correct ?    9 Yes 1 No

What does Class.forName return?..

Answer / ashish

yes sure it returns java.lang.class object.

Is This Answer Correct ?    7 Yes 1 No

What does Class.forName return?..

Answer / rajiv

hi......
Class.forName() is basically used to load the diver. forName() is static method thats why its directly call with class name( i:e Class)
which return java.lang.class object. n with the help of that object we establish the connection with database.

Is This Answer Correct ?    3 Yes 0 No

What does Class.forName return?..

Answer / prashant

Class.forNmae first loads the class in current classLoader so as to use that in future. Internally DriverManager gets the reference of the driver by using dynamic laoding (nothing is magical) this is is the reason when you say manager.GetConnection() it returns connection using the loaded driver

Is This Answer Correct ?    1 Yes 0 No

What does Class.forName return?..

Answer / sushant

the database hs been created using SQL server which is ODBC
complaint. Hence the JDBC-ODBC bridge driver will be used
to communication width the database the folloeing
statement will be used to load this driver

Is This Answer Correct ?    3 Yes 3 No

What does Class.forName return?..

Answer / surya, samcomm technologies pv

yes. It does return Class type.

code:-

try {
Class clazz=Class.forName("");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}

Is This Answer Correct ?    1 Yes 3 No

What does Class.forName return?..

Answer / sushant

Exception and SQLException

Is This Answer Correct ?    2 Yes 17 No

Post New Answer

More JDBC Interview Questions

Which package is used for jdbc application?

0 Answers  


What is benefit of using preparedstatement in java?

0 Answers  


Hi my doubt is that preparedStatement is a interface means which has no implemenation.plz go thru the code below String sql = "SELECT * FROM movies WHERE year_made = ?"; prest = con.prepareStatement(sql); prest.setInt(1,2002); ResultSet rs1 = prest.executeQuery(); Now setInt and executeQuery how it works since it is interface it does not have implementation how it works, how executeQuery returns result from database as executequery method has no implementation even in Statement interface.

4 Answers   Cybermate, Hexaware,


Is jpa faster than jdbc?

0 Answers  


Statement, PrepareStatement and Callable all these are interfaces. Thought it is a interface how come we are creating objects and calling methods("preparestatement()") in it. In which class this method is defined. Please let me know. Thanks in advance. example: PreparedStatement pre = con.prepareStatement( "UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ?");

2 Answers  






What is the function of drivermanager class?

0 Answers  


How can I retrieve a String or other object type without creating a new object each time?

0 Answers  


What is statement and resultset in jdbc?

0 Answers  


How to update a resultset programmatically?

0 Answers  


Can you define a foreign key, with a key from the same table?

2 Answers   IBM,


How to use JDBC API to call Stored Procedures?

0 Answers  


List the common jdbc exceptions ?

0 Answers  


Categories