This content has been marked as final. Show 3 replies
Start with 2 sorted arrays,
read the first element from both arrays;
write out whichever one is lexically smaller (pick one if they're equal);
read another entry from the same array whose element was written out;
loop back to the compare above;
You need to add EOF handling to this process. When either file shows EOF, there will still be one element that hasn't been written to the output.
Shift one closing brace, and your code should work (unless either of the array's current value is null). The brace to be shifted is the one before the following line:
else if (reLasts[j].compareTo(crLasts) < 0)
and it should be put right before the line having
And please use the code-tags for enclosing source to make it readable, if you post next time.