001package basics.checkargs;
002public class Main {
003        private Main() {}
004        static public void main (final String[] args) {
005                //stdlib.Trace.graphvizShowSteps (true); stdlib.Trace.run ();
006                try {
007                        System.out.println(new Person("bob"));
008                        System.out.println(new Person(null));
009                } catch (IllegalArgumentException e) {
010                        System.out.println("Error creating Person: " + e); 
011                }
012        }
013}
014final class Person {
015        final private String name;
016        public Person(String name) {
017                if (name == null)
018                        throw new IllegalArgumentException("null name");
019                this.name = name;
020        }
021        public String toString() { return "Person(" + name + ")"; };
022}