Confusing for me, Easy for you :P
From: Jazz (jazzmail2k_at_yahoo.com)
Date: 10/31/03
- Next message: Andrew Thompson: "Re: desktop mouse control"
- Previous message: David Holliday: "Re: destructor needed"
- Next in thread: Anton Spaans: "Re: Confusing for me, Easy for you :P"
- Reply: Anton Spaans: "Re: Confusing for me, Easy for you :P"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 06:11:52 GMT
Alright I'm new to Java and I'm in the middle of doing my java project. I
have a super class called SFactory that has 2 protected Queues named q1 and
q2. I was asked to create a class called PlateFactory that will extend
SPlateFactory.
The Factory constructor:
public Factory(int n)
/* builds two identical queues containing n randomly-
generated plates. The variables q1 and q2 (inherited
from SPlateFactory) may be initialized and accessed
directly in this constructor. */
This is what I did:
public Factory(int n) {
for (int i = 0; i < n;i++){
Plate p = new Plate();
q1.enqueue(p);
q2.enqueue(p.getCopy());
}
}
This is fine except that I need to first actually create the
2 new queues (empty) that q1 and q2 will reference.
How do i do that?
Thanks
Jazz
- Next message: Andrew Thompson: "Re: desktop mouse control"
- Previous message: David Holliday: "Re: destructor needed"
- Next in thread: Anton Spaans: "Re: Confusing for me, Easy for you :P"
- Reply: Anton Spaans: "Re: Confusing for me, Easy for you :P"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]