On 6/8/2015 12:43 AM, LSUaubert wrote:
I modified the Person class constructor to pass an instance of
AddressInterface . The main creates an instance of AddressImpl of type
AddressInterface that is passed to the Person instace then I use
getAddress to load another address instance.
package mypersoninterfaceproject;
public class Main {
public static void main(String[] args) {
// Create the data for person1
AddressInterface pAddress1 = new AddressImpl(1011, "Main
Street", "USA");
Person person1 = new Person("Sang", "Shin", pAddress1);
// Trying to print out the data
AddressInterface person1Addr = person1.getAddress();
System.out.println("person1's name is " +
person1.getName() );
System.out.println("person1's address is " +
person1Addr.getStreetNumber() + " " +
person1Addr.getStreetName() + " " +
person1Addr.getCountry() );
}
}
This worked.
Did the purpose of the homework was for the student to do this in
another way ?
No, the above is what I was looking for.
-S
Jeff
--
You received this message because you are subscribed to the Google
Groups "JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/d/optout.
--
-------------------------------------------------------------------
Sang Shin, [email protected]
President and Chief Instructor of JPassion.com (JavaPassion.com)
http://www.linkedin.com/in/javapassion (Linkedin)
http://twitter.com/javapassion (Tweeter)
Life is worth living... with Passion!
Practically Free 3 to 5 days Live, Hands-on, Online Codecamps on
Java,Spring,Hadoop,HTML5,Ruby/Rails,Grails,JavaScript/jQuery,Android
http://jpassion.com/codecamps
----------------------------------------------------------------------
--
You received this message because you are subscribed to the Google Groups
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/d/optout.