English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

UserData.java:48: illegal start of type
if ( ! Records ) {
^
UserData.java:97: expected
}
^
2 errors
from belove code
package demo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
public class UserData {
String firstname;
String lastname;
int countrycode;
String Dfirstname;
String printrow;
ResultSet Results;
//DB Connection related Variables
static Connection con = null;
Statement st = null;
static String URL;
static String username;
static String password;
static {
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
URL = "jdbc:mysql://localhost:3306/mbtest1";
username = "root";
password = "secret";
con = DriverManager.getConnection(URL,username,password);
} boolean Records = Results.next();
if ( ! Records ) {
System.out.println("No data returned");
}
try {
do {
DfirstnaSystem.out.println(printrow);
} while Result.next (

2006-10-08 18:24:46 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

anand21 here is your link find out for yourself

http://www.google.co.uk/search?hl=en&q=UserData+java+48+illegal+start+of+type&btnG=Search&meta=

2006-10-08 22:54:05 · answer #1 · answered by Joe_Young 6 · 0 0

Hey i think if u have try, you must have catch.
I think its must . But i am sure that there should not be even a single statement inbetween a try and catch block. I think my answer is right. Check out...

2006-10-11 13:55:23 · answer #2 · answered by Sudha P 2 · 0 0

the try block must be immediately followed by a catch or finally statement, put a catch block/finally the problem will be solved.

good luck.

2006-10-09 02:11:29 · answer #3 · answered by Anand 3 · 0 0

looks like the problem started with the line:

static {

2006-10-09 01:36:45 · answer #4 · answered by Bryan A 2 · 0 0

fedest.com, questions and answers