Thanks for checking it out. I'm very new to OOP and
Java but have done other programming.
What I'm trying to do is have one return that has a value so
ArrayList <Lot> unsold = new ArrayList <Lot>();
if this
unsold = // Carries all the unsold lots in ArrayList
//if no lots
else
//rather than null
String unsold = "No unsold lots at this time";
So mabey what I want to do here is add a String to
ArrayList <Lot> unsold = new ArrayList <Lot>();
instead of trying to change the type
ArrayList <Lot> unsold
is this possible?
Here is my method
-----------------------------------------------------------
public ArrayList getUnsold()
{
ArrayList <Lot> unsold = new ArrayList <Lot>();
Iterator it = lots.iterator();
while(it.hasNext()) {
Lot lot = (Lot) it.next();
Bid highestBid = lot.getHighestBid();
String description = lot.getDescription();
int number = lot.getNumber();
if(highestBid == null) {
unsold.add(lot);
// this is here just so I know where and what is goin on
System.out.println("Lot number: " + number +
description + " has not been sold.");
}else{
unsold = ???;
}
}
return unsold;
}
------------------------------------------------------------------
This works if I get rid of the else. Or I put another return in it
The easy thing would be to use another return in the
}else{
return //some other local var
Thanks to all that has taken the time to take a look!
Mike