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
posted
0
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
posted
0
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