public class ParentMain { public static void main (String[ ] args) { Parent p; int code; // Get the value for code; code = 1; if (code == 1) p = new Child1(); else p = new Child2(); System.out.println (p.getPrefix() + p.getClassName()); } // method main } // class ParentMain