为什么在引用通过构造函数传递的变量时出现错误?
以下是完整的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项目。
答案 0 :(得分:5)
当您的意思是.
时,您似乎正在使用+
。
是否有一位老PHP程序员? : - )