MY code is: public class P1{
public static void main(String ar[])
{
class.forName("java.lang.String");
}
}
errors i got are :New.java:5: error: <identifier> expected
class.forName("java.lang.String");
^
New.java:5: error: invalid method declaration; return type
required
class.forName("java.lang.String");
^
New.java:5: error: illegal start of type
class.forName("java.lang.String");
^
New.java:7: error: reached end of file while parsing
}
^
4 errors
HELP ME>......

Answers were Sorted based on User's Feedback



MY code is: public class P1{ public static void main(String ar[]) { ..

Answer / siva mukesh

I think first error is...
1.Here in class name is Class.So we have to write Class.forName...(C caps)
2.forName() is used to register Driver.we have to specify any one of four drivers.

Is This Answer Correct ?    7 Yes 3 No

MY code is: public class P1{ public static void main(String ar[]) { ..

Answer / khasim

I think first error is...
1.Here in class name is Class.So we have to write Class.forName...(C caps)
2.forName() is used to register Driver.we have to specify any one of four drivers

Is This Answer Correct ?    1 Yes 0 No

MY code is: public class P1{ public static void main(String ar[]) { ..

Answer / salman

public class P1
{
public static void main(String args[])
{
try
{
Class.forName("java.lang.String");
}catch(Exception ex){}
}
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More JDBC Interview Questions

What is the use of jdbc api?

0 Answers  


What are the types of statements in jdbc?

0 Answers  


Explain the sequence of steps to connect to the database?

3 Answers   Wipro,


any one can explain about policy file rule? when i connect database with applet then ther is no compile time error but the run time error is occureed.i.e access is denied.policy file rule is related to this problem.

0 Answers  


What are the factors that the jdbc driver performance depends upon?

0 Answers  


How can you know about drivers and database information ?

0 Answers  


Is jdbc a framework?

0 Answers  


Which is best database for java?

0 Answers  


What is the difference between client and server database cursors?

0 Answers  


what is meant by connection pooling?

4 Answers  


i have 1000 records in resultset, how to get first 100 records from resultset, because resultset fetch all 1000 records at a time?

8 Answers   HSBC,


Write an sql to find all records having all upper case alphanumeric characters in a field ?

0 Answers  


Categories