But isn't it doing it twice since it is calling getSuperClass two times. Respects,
JKid314159 http://existentialismagent001.blogspot.com/ --- On Tue, 7/14/09, Bitzenhofer, Neil (STP) <[email protected]> wrote: From: Bitzenhofer, Neil (STP) <[email protected]> Subject: RE: [java programming] Lab1023 Inheritance To: [email protected] Date: Tuesday, July 14, 2009, 2:05 PM Ale, It looks like class1 keeps getting set to the next higher superclass, until it runs out of superclasses. Neil Neil From: [email protected] [mailto:[email protected]] On Behalf Of Alex Sent: Tuesday, July 14, 2009 12:51 PM To: Free Java Programming Online Training Course by Sang Shin Subject: [java programming] Lab1023 Inheritance Dear Java Programmer: Lab 1023_javaiinheritance Code 1.30 Modified Main.java // Display the class hierarchy of the InternationalStudent // class through getSuperclass() method of Class class. Class class1 = internationalStudent1.getClass(); System.out.println("Displaying class hierarchy of InternationalStudent Class..."); while (class1.getSuperclass() != null){ String child = class1.getName(); String parent = class1.getSuperclass().getName(); System.out.println(" " + child + " class is a child class of " + parent); class1 = class1.getSuperclass(); } I have a question about this while loop. The expression is place in the (). But at the end the expression is placed into a variable. How is the loop being incremented? Do not understand logic here? Please comment. JKid314159 --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
