Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Scanner - Help

 
J Bow
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay so I have a 2 Scanner objects reading 2 different files. How can I get the 1st Scanner object to compare data with the 2 Scanner object 1 line at a time?

Example:
Scanner 1: test
Scanner 2: lol
Scanner 1: test
Scanner 2: lolol
Scanner 1: test
Scanner 2: test

Quit.
 
Joe Ess
Bartender
Posts: 9300
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
We would love to help, but we do ask that you DoYourOwnHomework. Read our FAQ on HowToAskQuestionsOnJavaRanch. The better question you ask, the more help we can be.
 
J Bow
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:Welcome to the JavaRanch.
We would love to help, but we do ask that you DoYourOwnHomework. Read our FAQ on HowToAskQuestionsOnJavaRanch. The better question you ask, the more help we can be.


Thanks.

I never said anything about this being homework though...

Okay, to better ask my question:

I need a method to go through and compare two arrays of Strings; every String method possible needs to be compared.

I'm trying to use the Scanner class to scan a file with a list of Strings in it and the same with another so I'm trying to find out a way for each line-to-line combination possible, be compared.

EDIT: I solved it by using ArrayList<String>() instead of String[].
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic