File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed
src/com/codefortomorrow/advanced/chapter14/solutions Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 16
16
public class Lexico {
17
17
18
18
public static void main (String [] args ) {
19
- try (BufferedReader br = new BufferedReader (new FileReader ("f1.txt" ));
20
- BufferedReader br2 = new BufferedReader (new FileReader ("f2.txt" ));) {
19
+ try (
20
+ BufferedReader br = new BufferedReader (new FileReader ("f1.txt" ));
21
+ BufferedReader br2 = new BufferedReader (new FileReader ("f2.txt" ));
22
+ ) {
21
23
String line1 = br .readLine ();
22
24
String line2 = br2 .readLine ();
23
25
int c = line1 .compareTo (line2 );
24
- while (c == 0 ){
25
- line1 = br .readLine ();
26
- line2 = br2 .readLine ();
27
- c = line1 .compareTo (line2 );
26
+ while (c == 0 ) {
27
+ line1 = br .readLine ();
28
+ line2 = br2 .readLine ();
29
+ c = line1 .compareTo (line2 );
28
30
}
29
- if (c > 0 )
30
- System .out .println ("File 2" );
31
- else
32
- System .out .println ("File 1" );
33
- } catch (IOException e ){
34
- e .printStackTrace ();
31
+ if (c > 0 ) System .out .println ("File 2" ); else System .out .println (
32
+ "File 1"
33
+ );
34
+ } catch (IOException e ) {
35
+ e .printStackTrace ();
35
36
}
36
37
}
37
38
}
You can’t perform that action at this time.
0 commit comments