s
Posts: 23
Nickname: codemonkey
Registered: Nov, 2003
|
|
Re: why doesnt it loop ? ? ?
|
Posted: Nov 7, 2003 6:49 AM
|
|
why are you checking temp for null when it shouldnt go into the loop if it is???? but i would say its broke because you are using a RETURN when you hit the first one!! Do you just want to print it out or should you be stuffing it into a Vector or something? i mean start off by knowing that multiple returns in a method are evil !
IntDLLNode tmp = head; IntDLLNode tmp1 = head ; IntDLLNode tmp2 = head ; for ( ; tmp != null ; tmp = tmp.next, tmp1 = tmp1.next,tmp2 = tmp2.next)// what are you doing with tmp2?? if ( tmp == null )///dont need this line i think. String returnValue; returnVal = "Passenger : " +tmp.info + " phone : "+tmp1.info1 + " \n "; if(//code to check for no flight){ returnValue="NO flight ";
return returnValue; //aaahhhh one return stmnt ! } //return ("No passenger on the flight " ); //else return ("Passenger : " +tmp.info + " phone : "+ //tmp1.info1 + " \n " ) ;
return ("NO flight " );
thats the best i can do with the limited info youve given .. good luck
|
|