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
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 |
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 |
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 |
Are all the required JDBC drivers to establish connectivity to my database part of the JDK?
What is com mysql jdbc driver?
How is jndi useful for Database connection?
What are the different types of 2 tier and 3 tier architecture ?
What is represented by the connection object?
Which jdbc drivers will run your program?
How can I determine where a given table is referenced via foreign keys?
What is type 4 jdbc driver?
is that compulsory to have Primarykey-forignkey for joints (outer inner,equal)
what is the meaning of following code snippets Class c=class.forName(driverClassName); Driver d=(driver)c.newInstance();
What happens if we don't close the connection in jdbc?
What is jdbc servlet?