*small correction in the below code  is *

interface AddressInterface {

    method1();
    method2();

}

interface MyOwnInterface {

     public AddressInterface getAddress();
}

class AddressImpl implements AddressInterface {

     public void method1(){

      }

     public void method2(){

      }

  }


class Person implements MyOwnInterface {

    public AddressInterface getAddress(){

           return new AddressImpl ();

       }

    public static void main(String args[]){*

         AddressInterface  addressI = new Person().**getAddress()**;

        * addressI.method1();
         addressI.method2();

     }

}

Thanks

Srinivas

On Wed, Nov 12, 2008 at 12:08 PM, srinivas dumpala
<[EMAIL PROTECTED]>wrote:

> *Please check this code below. i hope u got it
>
> interface AddressInterface {
>
>     method1();
>     method2();
>
> }
>
> interface MyOwnInterface {
>
>      public AddressInterface getAddress();
> }
>
> class AddressImpl implements AddressInterface {
>
>      public void method1(){
>
>       }
>
>      public void method2(){
>
>       }
>
>   }
>
>
> class Person implements MyOwnInterface {
>
>     public AddressInterface getAddress(){
>
>            return new AddressImpl ();
>
>        }
>
>     public static void main(String args[]){
>
>          AddressInterface  addressI = new Person().**getAddress()**;
>
>          addressI.method1();
>          addressI.method2();
>
>      }
>
> }*
>
>
> On Wed, Nov 12, 2008 at 10:14 AM, Simon Moffatt <[EMAIL PROTECTED]>wrote:
>
>>
>> This issue I'm having is that according to the homework, Person.java
>> needs to implement MyOwnInterface which has a method of return type
>> AddressInterface:
>>
>> public AddressInterface getAddress()
>>
>> ..and I don;t know how to return any data to this.
>>
>> AddressInterface contains the abstract methods that AddressImpl
>> implements, but I don't know how to link them together......
>>
>>
>>
>>
>> jagan jag wrote:
>> > u can extend one interface from another interface by using "extends"
>> > keyword
>> >
>> > On Wed, Nov 12, 2008 at 12:48 AM, Simon Moffatt <[EMAIL PROTECTED]
>> > <mailto:[EMAIL PROTECTED]>> wrote:
>> >
>> >
>> >     Hi all
>> >
>> >     I'm having great difficulty in figuring out this homework.  I have
>> >     created the AddressInterface and AddressImpl classes easily enough
>> >     but don't understand how to relate MyOwnInterface to
>> AddressInterface.
>> >
>> >     Any ideas welcome, I'm really stuck!
>> >
>> >     Thanks
>> >
>> >     Simon
>> >
>> >     >
>> >
>> >
>> >
>> > --
>> > jagan
>>
>>
>> --
>>
>>
>> >>
>>
>
>
> --
> Thanks & Regards
>
> Srinivas
> (214-597-0697)
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to