(String[] args)
| 22 | "\n password: " + password; |
| 23 | } |
| 24 | public static void main(String[] args) { |
| 25 | Logon a = new Logon("Hulk", "myLittlePony"); |
| 26 | System.out.println("logon a = " + a); |
| 27 | try( |
| 28 | ObjectOutputStream o = |
| 29 | new ObjectOutputStream( |
| 30 | new FileOutputStream("Logon.dat")) |
| 31 | ) { |
| 32 | o.writeObject(a); |
| 33 | } catch(IOException e) { |
| 34 | throw new RuntimeException(e); |
| 35 | } |
| 36 | new Nap(1); |
| 37 | // Now get them back: |
| 38 | try( |
| 39 | ObjectInputStream in = new ObjectInputStream( |
| 40 | new FileInputStream("Logon.dat")) |
| 41 | ) { |
| 42 | System.out.println( |
| 43 | "Recovering object at " + new Date()); |
| 44 | a = (Logon)in.readObject(); |
| 45 | } catch(IOException | ClassNotFoundException e) { |
| 46 | throw new RuntimeException(e); |
| 47 | } |
| 48 | System.out.println("logon a = " + a); |
| 49 | } |
| 50 | } |
| 51 | /* Output: |
| 52 | logon a = logon info: |
nothing calls this directly
no test coverage detected