This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null Arrays

 
Sean Magee
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there!

I am having a problem in one of my programs and i cant seem to get ir right.
I have an array, that holds an object. I go through this array with a for loop checking if any of the slots in the array are null, if a spot is null return true, if the entire array is full, return false. Then it prints everything in the array.

The problem is, this is looped, so when it does it again, its like it was never done the first time and the entire array was set back to null and the values were never there!

Thank you for your help
[ March 06, 2005: Message edited by: Sean Magee ]
 
Horatio Westock
Ranch Hand
Posts: 221
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's difficult to understand what is happening. Could you post the relevant code for us to have a look at? Remember to use the 'CODE' button before you copy and paste.
 
Sean Magee
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the code on my laptop, but i try my best to replicate here.

I am having problems with two of my classes, but i think i have to throw the code out for three so you can understand my problem




Ok, so thats the code where the touble lies I think. I have a couple of other classes that I am not showing, like the talk class which mainly deal with the userinput and alos haas a boolean vairable that is assigned by the addCust method, but of course, it never returns false. The talk class also askes which bus the user would like to ride, and how many people the user would like to book, indicated by the passnum and depart integers being passed through the toBooker method in the mainstreet class. However when this
JOptionPane.showMessageDialog(null,""+fullorder);
talk again = new talk();
again.askToPurchase();
executes, it askes the user again which shuttle, which departure, and if you pick the same one as before,

the customer array,
the order array,
and the shuttle array

all have seem to be reset back to null, and did not store the original values that were set by the user.

Can you see what i am doing wrong here?
[ March 06, 2005: Message edited by: Sean Magee ]
 
Sean Magee
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this enought code to identify the problem??

If it isn;t please let me know so I can make additions accordingly.
 
Horatio Westock
Ranch Hand
Posts: 221
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. Sorry, I forgot about this yesterday. The code you have supplied is insufficient to understand the problem (and some of it doesn't seem valid).

If you post the rest, and point out where in the code you are having a problem, someone will help.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic