• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

why doesn't this work?

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The compiler says it can't see the file1 and file2 .readLine() methods in the getLine method. Why?
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic