Results 1 to 3 of 3
  1. #1
    bbfunk is offline Member
    Join Date
    Oct 2012
    Posts
    15
    Rep Power
    0

    Default Inserting a method with arguements into another method with no arguements?

    I have 2 methods:

    1. public void moveBackground()
    {
    moves background (50x50 pixel shape) co-ordinates right by 100 units
    }

    2.public void moveApples(Apple anApple)
    {
    moves a specific apple variable right by 100 units
    }

    I now have to make a third method that will automatically invoke these two methods:

    3. public void moveAll()
    {
    this.moveBackground()
    this.moveApples()???
    {

    This gives an error in method 3 with the moveApples() method.
    I have absolutely no idea how to do this as it has arguments yet the 3rd method moveAll isn't allowed any arguements.

    I have spent way too long on this and would really appreciate some help.

    Thanks

  2. #2
    J-max04 is offline Member
    Join Date
    May 2012
    Posts
    17
    Rep Power
    0

    Default Re: Inserting a method with arguements into another method with no arguements?

    You need a list of all of the apples and then you need to parse through them and move them all.

  3. #3
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default Re: Inserting a method with arguements into another method with no arguements?

    Yeah, J-max is on the right track, do you have a collection of apples which your are trying to move? I suspect you need a loop to iterate through them and apply your move method to each!

Similar Threads

  1. Replies: 2
    Last Post: 03-23-2012, 05:53 AM
  2. Replies: 1
    Last Post: 10-27-2011, 08:16 AM
  3. Replies: 1
    Last Post: 10-17-2011, 02:00 AM
  4. Turning Recursion Method into Iterative method
    By mattakuevan in forum New To Java
    Replies: 9
    Last Post: 06-15-2010, 07:46 AM
  5. [SOLVED] commandline arguements
    By raghu9198 in forum New To Java
    Replies: 3
    Last Post: 12-23-2008, 10:47 AM

Posting Permissions

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