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

Does jpa use jdbc?

0 Answers  


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

0 Answers  


What is setautocommit in jdbc?

0 Answers  


How we store procedure in oralce for callable statements in jdbc

0 Answers  


How to check jdbc connection in linux?

0 Answers  






What is JDBC ResultSet?

0 Answers  


What is serialization and deserialization in java programming?

0 Answers  


Is jdbc faster than hibernate?

0 Answers  


How to execute bulk number of queries at once?

3 Answers   Wipro,


How to handle when the database crashes while reading the data from the database?

2 Answers   IBM,


What is static Synchronized method in JDBC API? Give an example?

3 Answers   3 Edge Solutions, R Systems, Sirvisetti Global Services,


Which constraint cannot be specified as an explicit constraint and should be specified with the column only ?

0 Answers  


Categories