001package basics.dependency; 002import java.util.Random; 003final class Person { 004 final private String name; 005 public Person(String name) { this.name = name; } 006 public String toString() { return "Person(" + name + ")"; }; 007} 008class PersonFactory { 009 private PersonFactory() {} 010 static private Random random = new Random(); 011 static public Person randomPerson() { 012 return new Person(Integer.toString(random.nextInt())); 013 } 014}