为什么在引用通过构造函数传递的变量时出现错误?
这是完整的 Customer.java 类:
import java.sql.ResultSet;
import javax.servlet.http.HttpServletRequest;
public class Customer {
// SQL Variables
private final String URL = "jdbc:mysql://localhost/books";
private final String USER = "root";
private final String PASSWORD = "P@ssw0rd1";
// Class Variables
int CustomerID;
String customerEmail;
String customerPassword;
String customerFirstName;
String customerLastName;
String customerAddress;
String customerCity;
String customerProvince;
String customerPostalCode;
String customerPhoneNumber;
String customerCreditCardNumber;
String customerExpiryDate;
String customerCreditCardType;
// Class Constructors
public Customer(int customerID) // Constructor for an Existing Customer
{
ResultSet customerData = MySQLQuery("select * from Customers where CustomerID=" . customerID);
}
public Customer(HttpServletRequest post) // Constructor for a new customer
{
}
// Constructor Methods
public ResultSet MySQLQuery(String query)
{
return queryResultSet;
}
// Getters and Setters
}
这是在 NetBeans 7.3 中在默认包内的 Customer.java 类中创建的 Java Web 项目。