File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes where is my  silly mistake Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "where is my  silly mistake" Watch "where is my  silly mistake" New topic
Author

where is my silly mistake

Lindsey Ship
Greenhorn

Joined: Feb 07, 2003
Posts: 19
Hi I have done what I hope is a 3 dimensional array, all I am doing is to get it to print out Liverpool and the 3 flight numbers, but i am confused over the [][][] if i have the right values as it print outs
"rubbish" flights "rubbish"
here is my code so far,
Lindsey Ship
Greenhorn

Joined: Feb 07, 2003
Posts: 19
Sorry I should have pointed out I wanted to print all flights from Liverpool 3 in all
Thanks if you can advise
Lindsey
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Lindsey,
u want,

hope this helps....
sorry ...u told that i shoudn't post the code in earlier post but i am unable to explain otherwise..
here u will need dynamic list (String[]) as you don't know how many flights matches your input.
now u can't do that just using String[]. so u have two options now,
1. use Vector of String (which can have dynamic elements added to it)
2. use some other structure to store dynamic listing
Vector would be little complex as you need String[] as return value of the method.
java.awt.List sounds wiered but thats what i 've used so many times as it provides flexibility. no other Java class allows us to just go on adding string in String format AND retrieve the list by just one method call, which is list.getItems() in this case.
regards
maulin.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
and
as far as ur mistake is concerned..
u 've it at ,

result = new String[3];// not sure what figure goes here
result[i] = tdi[0][0][0];

as u said u were not sure about new String[3] statement..
u can't put it there as otherwise u'd end up creating new array for each matching Airport input and so the latest one would be returned having only one of the flight (as previous list is forgotten now when we do new String[])..
u get what i am trying to explain?
so u have to create it only ONCE and you should be able to ADD dynamically to that result as you encounter matches...
regards
maulin
Lindsey Ship
Greenhorn

Joined: Feb 07, 2003
Posts: 19
Thanks a million
I will log off now and try rewriting my code, it seems what we get told and what you guys do are worlds apart.
thanks again for your help and I hope the weather in your country is warmer than it is here in the UK
good night
lindsey
 
 
subject: where is my silly mistake