package demo; /** * A widget for demonstration of Javadoc. */ public class Foo { /* no fields */ /** * Prints information indicating that the constructor has been called. */ public Foo() { System.out.println("new Foo();"); } /** * Prints information indicating that bar(x) has been called. * @param x Determines value printed between the parens. * @throws IllegalArgumentException if x < 0. * @return "baz" */ public String bar(int x) { if (x <= 0) { throw new IllegalArgumentException( "bar called with negative input."); } // see: PrintStream.format - the "%d" is replaced with the value of x. System.out.format("bar(%d);\n", x); return "baz"; } }