aspose file tools*
The moose likes Java in General and the fly likes why doesn't this work? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "why doesn Watch "why doesn New topic
Author

why doesn't this work?

Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
The compiler says it can't see the file1 and file2 .readLine() methods in the getLine method. Why?


CNSS/NSA Infosec Professional,<br />Software Engineer
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Within the scope of the getLine method, what is a file1 and a file2? (I can see them clearly in the main method.)


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
That's what I want to know... file1 and file2 are BufferedReader's defined in main. Why doesn't it see them in getLine()?
Ok, bright Idea... what if read the files completely in the getLine method into 2 separate array lists and compare the entries that way?
[ November 26, 2002: Message edited by: Sam Smoot ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

file1 and file2 are defined in your main method. That's why getLine() can't see them. SCOPE SCOPE SCOPE. You either need to define your file1 and file2 outside of main() or, a better idea, pass them to your getLine(BufferedReader file1, BufferedReader file2) method.


GenRocket - Experts at Building Test Data
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
Well clean my boots and pluck the chickens... This worked...
[I've been "Struts'ing" too much... forgot how to code...]
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why doesn't this work?