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

Explain about the drive manager class working?

0 Answers  


How MS-Access DB can be accessed over a network, using JDBC API?

0 Answers  


What are the methods which can verify the cursor particular position?

0 Answers  


How do java applications access the database using jdbc?

0 Answers  


What is thin driver in jdbc?

0 Answers  






Explain the locking system in jdbc & its types?

0 Answers  


What are the benefits of PreparedStatement over Statement?

0 Answers  


how we can remove hard code in java?

1 Answers   Satyam,


Diff bet.. Function and Trigger?

3 Answers   Logica CMG,


What type of drivers are used for web application?

2 Answers  


What is Apache DBCP API?

0 Answers  


What do you mean by two phase commits?

0 Answers  


Categories