File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ package editor ;
2+
3+ import java .io .*;
4+
5+ public class Editor {
6+
7+ public static void main (String [] args ) throws IOException , InterruptedException {
8+ //create a BufferedReader using System.in
9+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
10+
11+ //create an array of string object, that reads in lines of text and storing each line in the array
12+ String str [] = new String [100 ];
13+
14+ //stopping condition
15+ System .out .println ("Enter 'Stop' to quit" );
16+
17+ //asking the lines of text
18+ System .out .println ("Enter lines of text: " );
19+
20+ for (int i =0 ; i <100 ; i ++) {
21+ str [i ] = br .readLine ();
22+
23+ //break condition
24+ if (str [i ].equalsIgnoreCase ("stop" )) {
25+ break ;
26+ }
27+ }
28+
29+ Thread .sleep (1000 );
30+ System .out .println ("----------------------------------------------" );
31+ System .out .println ("Here is your file: " );
32+
33+ //displaying the line
34+ for (int i =0 ; i <100 ; i ++) {
35+ if (str [i ].equalsIgnoreCase ("stop" )) {
36+ Thread .sleep (1000 );
37+ System .out .println ();
38+ System .out .println ("Thank you" );
39+ break ;
40+ }
41+
42+ System .out .println (str [i ]);
43+ }
44+
45+ }
46+
47+ }
You can’t perform that action at this time.
0 commit comments