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 88 * Source: https://beginnersbook.com/2014/01/how-to-read-file-in-java-using-bufferedreader/
99 */
1010public class BufferedReaderExample {
11- public static void main (String [] args ) {
1211
12+ public static void main (String [] args ) {
1313 BufferedReader br = null ;
1414 BufferedReader br2 = null ;
1515
@@ -28,19 +28,14 @@ public static void main(String[] args) {
2828
2929 //Second way of reading the file
3030 System .out .println ("Reading the file using read() method:" );
31- int num = 0 ;
31+ int num = 0 ;
3232 char ch ;
33- while ((num =br2 .read ()) != -1 )
34- {
35- ch =(char )num ;
33+ while ((num = br2 .read ()) != -1 ) {
34+ ch = (char ) num ;
3635 System .out .print (ch );
3736 }
38-
39- }
40- catch (IOException ioe )
41- {
37+ } catch (IOException ioe ) {
4238 ioe .printStackTrace ();
4339 }
4440 }
4541}
46-
You can’t perform that action at this time.
0 commit comments