aspose file tools*
The moose likes Java in General and the fly likes How to display 2 different file in IO java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to display 2 different file in IO java" Watch "How to display 2 different file in IO java" New topic
Author

How to display 2 different file in IO java

ten chang
Greenhorn

Joined: Apr 05, 2013
Posts: 9
hey all,
how can i display content of two different fileName.txt file in a display one by one. IO java
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18909
    
    8

That depends on what "one by one" means. Could you clarify your question?
ten chang
Greenhorn

Joined: Apr 05, 2013
Posts: 9
hey paul,
the link below is my code, i need all the saved user input(lowerClassMan.txt and upperClassMan.txt) to display out one after another. i kinda have it running but the problem is i get only 1 data one from each. and when it display the data of lowerClass it shows in horizontal and upperClass in vertical. somthing like this :
d,f,3,44
d
c
6
77


http://www.coderanch.com/t/608898/java/java/save-file-condition-File-IO
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1510
    
    5

Hi,

In the link mentioned by you, I found the code. But, that code does not read and/or write from/to file upperClassMan.txt. Are you sure this is the correct code? If not, please show us the code.

Also, I would follow simple logic:
1) counter = 0
2) Read line number 'counter' from file 1
3) Read line number 'counter' from file 2
4) counter++;
Keep on iterating from step 2 until both files are done.

Of course, this is very bare-bone logic. You'll need to consider what happens when both files are not having equal number of files, and/or if one file is empty etc. But first, let's see your code and also let us know about actual file contents.

I hope this helps.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
ten chang
Greenhorn

Joined: Apr 05, 2013
Posts: 9
oahh sorry, this is the full code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display 2 different file in IO java