File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
src/com/codefortomorrow/advanced/chapter14/examples Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change 8
8
* Source: https://beginnersbook.com/2014/01/how-to-read-file-in-java-using-bufferedreader/
9
9
*/
10
10
public class BufferedReaderExample {
11
- public static void main (String [] args ) {
12
11
12
+ public static void main (String [] args ) {
13
13
BufferedReader br = null ;
14
14
BufferedReader br2 = null ;
15
15
@@ -28,19 +28,14 @@ public static void main(String[] args) {
28
28
29
29
//Second way of reading the file
30
30
System .out .println ("Reading the file using read() method:" );
31
- int num = 0 ;
31
+ int num = 0 ;
32
32
char ch ;
33
- while ((num =br2 .read ()) != -1 )
34
- {
35
- ch =(char )num ;
33
+ while ((num = br2 .read ()) != -1 ) {
34
+ ch = (char ) num ;
36
35
System .out .print (ch );
37
36
}
38
-
39
- }
40
- catch (IOException ioe )
41
- {
37
+ } catch (IOException ioe ) {
42
38
ioe .printStackTrace ();
43
39
}
44
40
}
45
41
}
46
-
You can’t perform that action at this time.
0 commit comments