CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    interface question

    Hello all,

    I'm getting into Java and trying to pick up as much as I can. I have run into an exercise that I just haven't been able to get for myself yet, so I'm looking for help. I'm supposed write a class that implements the following interface:

    interface test{
    int[] number(int start, int stop, int step);
    //Returns an array of the minimum size required with the
    //first value of start, and each following value step
    // greater than the last value.

    Vector arraytoVector(int[] inputArray);
    // returns a vector for the integer array
    }
    }

    Can someone help me? I'd really appreciate it.

    Thanks in advance,

    DJ Gardner


  2. #2
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    Re: interface question


    This is how you have to do..



    public class TestImpl implements test{
    // you have to implement both the functions over here. otherwise
    // this class will become an abstract class..

    public int[] number( int start , int stop , int step ){
    // Do something , and return int array
    }

    public Vector arrayToVector( int[] inputArray ){
    // Do something , and return Vector
    }
    }





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured