Java Reference
In-Depth Information
48
return firstName;
49
}
50
51
// sets the lastName
52
public void setLastName(String lastName)
53
{
54
this .lastName = lastName;
55
}
56
57
// returns the last name
58
public String getLastName()
59
{
60
return lastName;
61
}
62
63
// sets the email address
64
public void setEmail(String email)
65
{
66
this .email = email;
67
}
68
69
// returns the email address
70
public String getEmail()
71
{
72
return email;
73
}
74
75
// sets the phone number
76
public void setPhoneNumber(String phone)
77
{
78
this .phoneNumber = phone;
79
}
80
81
// returns the phone number
82
public String getPhoneNumber()
83
{
84
return phoneNumber;
85
}
86
} // end class Person
Fig. 24.30 | Person class that represents an entry in an AddressBook . (Part 2 of 2.)
Class PersonQueries
Class PersonQueries (Fig. 24.31) manages the address book application's database con-
nection and creates the PreparedStatement s that the application uses to interact with the
database. Lines 18-20 declare three PreparedStatement variables. The constructor (lines
23-49) connects to the database at lines 27-28.
1
// Fig. 24.31: PersonQueries.java
2
// PreparedStatements used by the Address Book application.
3
import java.sql.Connection;
Fig. 24.31 | PreparedStatements used by the Address Book application. (Part 1 of 5.)
 
Search WWH ::




Custom Search