The Person class should implement : PersonInterface,
AnotherInterfaceExample, MyOwnInterface{}Someone else had a good solution they did. In the person class you do something like. AddressImpl address = new AddressImpl(); and your getaddress method will return address. in main you can reference using something like: person2.address.setStreetNumber(45); ---------- Religion is to do right. It is to love. It is to think. It is to serve. It is to be humble. -Ralph W Emerson 2009/3/18 Rafał Laczek <[email protected]> > > Person class extends AddressImpl class and it has now following > constructor and method. > > > AddressInterface address; > // Constructor with arguments > Person( int streetNumber, > String streetName, > String country, > AddressInterface address){ > super(streetNumber, streetName,country); > this.address=address; > } > > //Implementation of the method > public AddressInterface getAddress(){ > return address; > } > > } > > > I have also created Person object in Main but there s a problem to > initialize it with data. > Person person1 = new Person(10, "Java Street", "Korea"); > > In constructor we have theoretically 4 parameters and I have passed 3 > > What I should to do here? > > Thank you for reply > > Best regards, > > > Dnia 18-03-2009 o godz. 14:29 Min napisał(a): > > On Mar 18, 6:22 pm, Rafał Laczek <[email protected]> wrote: > > > Hello Fiends, > > > > > > In my homework Person class extends AddressImpl and implemnts > > > MyOwnInterface > > > I have created constructor according to arguments in this class and > > > AddressImpl one. > > > > > > I have a problem with implementation of public AddressInterface > > > getAddress(){ > > > return ....???? > > > > > > } > > I do not approach this the way you do. Anyway: > > // Your person extended addressImpl. Try to return the parent: > > public AddressInterface getAddress(){ > > return super; > > } > > > > > > Should this method return all following methods? > > > public int getStreetNumber() > > > public String getStreetName() > > > public String getCountry() > > > > > > Thank you in advance for your help! > > > > > > Best regards, > > > Rafał Laczek > > > > > > ---------------------------------------------------- > > > Zło zrobi wszystko, by zaistnieć... > > > Thriller NIENARODZONY w kinach od 20 marca! > > > Zobacz zwiastun filmu > > --> > http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fnienarodzo... > > > > > ---------------------------------------------------- > Zło zrobi wszystko, by zaistnieć... > Thriller NIENARODZONY w kinach od 20 marca! > Zobacz zwiastun filmu --> > http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fnienarodzony.html&sid=666 > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
