TrainBeaser for iPhone
The moose likes I/O and Streams and the fly likes io question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Reply Bookmark "io question" Watch "io question" New topic
Author

io question

patrick tang
Ranch Hand

Joined: Dec 16, 2001
Posts: 44
hi all, i've a question about io

i'm trying to use method findStore(string s) to find the store with the same name as s. the idea is in gui,i can select the store from a combobox and read the catalogue of that particular store to a textarea. the problem is that findStore doesnt work. you may see that there're two stores in the mall. when i try to find store2, it wont return yes and that store file. i've spent a lot of time on it but still dont get it.
can anyone pls help me out...again? thanks in advance
[ February 18, 2002: Message edited by: patrick tang ]
John Spindler
Greenhorn

Joined: Feb 12, 2002
Posts: 28
Are these stored in two different files?
Mall.java and StoreTest.java?
[ February 27, 2002: Message edited by: John Spindler ]
Kathy Rogers
Ranch Hand

Joined: Aug 04, 2000
Posts: 103
Hi Patrick,
Looking at the Java API, getName() returns the very last element of the file's path - so for a file C:\mall\store2, it would return "store2". That's what s2 is set to. But you're setting s1 to "mall\store2" ("mall" + File.separator + s) - so s1 and s2 won't be equal and you won't find the store. I think you should probably just compare s2 to s.
Hope this helps,
Kathy
 
 
subject: io question
 
Threads others viewed
file/io question during practising
write to a file in another class
io/string question
Need Help in Sorting Multiple columns!
String Pool
developer file tools