Java Reference
In-Depth Information
We then have three constructors: a default constructor (required for any serialized
object), a constructor that assumes we have only one copy of the DVD in stock, and a con-
structor that allows us to specify how many copies of the DVD we have.
140 public DVD() {
141 log.finer("No argument constructor for DVD called");
142 }
...
157 public DVD(String upc, String name, String composer,
158 String director, String lead, String supportActor,
159 String year) {
160 this(upc, name, composer, director, lead, supportActor , year, 1);
161 }
162
163 /**
164 * Creates an instance of this object with a specified list of initial
165 * values.
166 *
167 * @param upc The UPC value of the DVD.
168 * @param name The title of the DVD.
169 * @param composer The name of the movie's composer.
170 * @param director The name of the movie's director.
171 * @param leadActor The name of the movie's leading actor.
172 * @param supportingActor The name of the movie's supporting actor.
173 * @param year The date the of the movie's release (yyyy-mm-dd).
174 * @param copies The number of copies in stock.
175 */
176 public DVD(String upc, String name, String composer, String director,
177 String leadActor, String supportingActor, String year,
178 int copies) {
179 log.entering ("DVD", "DVD",
180 new Object[]{upc, name, composer, director, leadActor,
181 supportingActor, year, copies});
182 this.upc = upc;
183 this.name = name;
184 this.composer = composer;
185 this.director = director;
186 this.leadActor = leadActor;
187 this.supportingActor = supportingActor;
188 this.year = year;
189 this.copy = copies;
190 log.exiting ("DVD", "DVD");
191 }
The comments were left in the final constructor, to show how parameters are declared
in Javadoc comments. As you can see, there is no requirement to specify the type of each
parameter.
Search WWH ::




Custom Search