001 /** 002 * Exercise 4.2 from the book * 003 * 004 * @author Kristian Torp, torp (at) cs (dot) aau (dot) dk 005 * @version 1.0 006 * 007 */ 008 public class Exercise4_2 { 009 010 /** The default constructor */ 011 Exercise4_2() { 012 System.out.println("Make an object with default constructor"); 013 } 014 015 /** 016 * Constructor that takes a single string argument. 017 * 018 * @param s 019 * A string argument that is simply printed 020 */ 021 Exercise4_2(String s) { 022 System.out.println("Make an object with " + s); 023 } 024 025 /** 026 * The main method that creates new objects. 027 */ 028 public static void main(String[] args) { 029 Exercise4_2 c1 = new Exercise4_2(); 030 Exercise4_2 c2 = new Exercise4_2("argument"); 031 Exercise4_2 c3 = new Exercise4_2("another argument"); 032 } 033 } 034