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>......

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is jdbc faster than hibernate?

650


How can I use the JDBC API to access a desktop database like Microsoft Access over the network?

621


What is the function of setautocommit?

731


How many jdbc driver types are there?

554


How can we store the file in the oracle database?

591






What is the meaning of “dirty read” in the database?

641


What are the main components of JDBC ?

649


How to update a resultset programmatically?

677


What is JDBC Connection? Explain steps to get Database connection in a simple java program.

704


What is ojvm used for?

650


What are the different types of interfaces in the api component?

615


Explain about multiple implementations and drive manager?

656


What is difference between statement and preparedstatement in jdbc?

541


What is jdbc and jdbc drivers?

573


What are the different types of statements? How we can you use preparedstatement.

586