-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
33 lines (27 loc) · 894 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import db.Database;
public class Main {
private static final String EXIT = "exit";
private static final String PROMPT = "> ";
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
Database db = new Database();
System.out.print(PROMPT);
String line = "";
while ((line = in.readLine()) != null) {
if (EXIT.equals(line)) {
break;
}
if (!line.trim().isEmpty()) {
String result = db.transact(line);
if (result.length() > 0) {
System.out.println(result);
}
}
System.out.print(PROMPT);
}
in.close();
}
}