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

How many types of jdbc drivers are available?

0 Answers  


How many categories of jdbc drivers are there?

0 Answers  


Can we use the one instance of Statment to execute more than one query ?

2 Answers   TCS,


What is connection pooling? What Method and class used for Connection pooling in Java?

2 Answers  


What is JDBC Driver interface?

0 Answers  


RowSetInternal caller and returns void. What can I do in the readData method?

0 Answers  


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 does jdbc do?

0 Answers  


What are devices?

0 Answers  


How do I find ojdbc jar version?

0 Answers  


What is JDBC DataSource and what are it’s benefits?

0 Answers  


What is jdbc thin client?

0 Answers  


Categories