1 9 10 package addressbook; 11 12 import java.io.BufferedReader ; 13 import java.io.IOException ; 14 import java.io.InputStreamReader ; 15 16 20 public class RunTxt { 21 22 23 public RunTxt() { 24 } 25 26 29 public static void main(String [] args) throws IOException { 30 DBHelper.setUpDB(); 32 System.out.println("================ DB Output ======================"); 33 for (Object o: DBHelper.getData()) { 34 System.out.println(o); 35 } 36 System.out.println("================================================="); 37 BufferedReader r = new BufferedReader (new InputStreamReader (System.in)); 38 Person p = new Person(); 39 System.out.println("Surname: "); 40 p.setName(r.readLine()); 41 System.out.println("Name: "); 42 p.setSurname(r.readLine()); 43 Address a = new Address(); 44 System.out.println("Street: "); 45 a.setStreet(r.readLine()); 46 System.out.println("City: "); 47 a.setCity(r.readLine()); 48 System.out.println("Country: "); 49 a.setCountry(r.readLine()); 50 p.setAddress(a); 51 DBHelper.add(p); 52 System.out.println("================ DB Output ======================"); 53 for (Object o: DBHelper.getData()) { 54 System.out.println(o); 55 } 56 System.out.println("================================================="); 57 } 58 59 } 60 | Popular Tags |