public static void main(String[] args) { // TODO code application logic here Person peterParker = new Person(); Person spiderMan = peterParker; spiderMan.hairColor = PINK; System.out.println("Hair Color of Peter Parker: " + peterParker.hairColor); System.out.println("Hair Color of Spiderman: " + spiderMan.hairColor); }
@Override public void delete(Person p) { int i = 0; for (Person tmp : pp) { if (p.getId() == tmp.getId()) break; i++; } pp.remove(i); // mm.remove(p.id); }
@Override public void update(Person p) { for (Person tmp : pp) { if (p.getId() == tmp.getId()) { tmp.setId(p.getId()); tmp.setfName(p.getfName()); tmp.setlName(p.getlName()); tmp.setAge(p.getAge()); } } // mm.put(p.id, p); }
@Override public void create(Person p) { pp.add(new Person(p.getId(), p.getfName(), p.getlName(), p.getAge())); }