KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > addressbook > RunTxt


1 /*
2  * RunTxt.java
3  *
4  * Created on 19. leden 2006, 18:46
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package addressbook;
11
12 import java.io.BufferedReader JavaDoc;
13 import java.io.IOException JavaDoc;
14 import java.io.InputStreamReader JavaDoc;
15
16 /**
17  *
18  * @author jungi
19  */

20 public class RunTxt {
21     
22     /** Creates a new instance of RunTxt */
23     public RunTxt() {
24     }
25     
26     /**
27      * @param args the command line arguments
28      */

29     public static void main(String JavaDoc[] args) throws IOException JavaDoc {
30     // TODO code application logic here
31
DBHelper.setUpDB();
32     System.out.println("================ DB Output ======================");
33     for (Object JavaDoc o: DBHelper.getData()) {
34         System.out.println(o);
35     }
36     System.out.println("=================================================");
37     BufferedReader JavaDoc r = new BufferedReader JavaDoc(new InputStreamReader JavaDoc(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 JavaDoc o: DBHelper.getData()) {
54         System.out.println(o);
55     }
56     System.out.println("=================================================");
57     }
58     
59 }
60
Popular Tags