Skip to content

Commit 90ffb04

Browse files
authored
Add files via upload
1 parent 662a359 commit 90ffb04

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
1.44 KB
Binary file not shown.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
}

0 commit comments

Comments
 (0)