• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why doesn't this work?

 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The compiler says it can't see the file1 and file2 .readLine() methods in the getLine method. Why?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Within the scope of the getLine method, what is a file1 and a file2? (I can see them clearly in the main method.)
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well clean my boots and pluck the chickens... This worked...
[I've been "Struts'ing" too much... forgot how to code...]
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic