Results 1 to 9 of 9
Thread: int arguments
- 01-09-2013, 03:44 AM #1
Member
- Join Date
- Jan 2013
- Posts
- 4
- Rep Power
- 0
int arguments
Hi
i am really struggling with something which i think is very basic.
i am trying to write a piece of code that will allow 2 objects to move into 2 different positions
I will show you what the method looks like, then maybe you can tell me where i am going wrong
public void moveToPosition (int a, int b)
{
object1.setPosition(a)
object2.setPosition(b)
}
when i try having just (int a) and applying it to both variables the objects move into the same position, but i just can't figure out how to move them to different positions.
thanks
-
Re: int arguments
What's wrong with the code you're showing us? Does it cause bad behavior? Does it not compile?
Also, when posting code, don't highlight it with bold tags, [b] [/b]. Instead use code tags: [code] [/code] so that your code formatting is retained.
- 01-09-2013, 04:27 AM #3
Member
- Join Date
- Jan 2013
- Posts
- 4
- Rep Power
- 0
Re: int arguments
hi
first of all i am using something called blueJ which is a training platform
it compiles, but when i try to move the objects in the display i get an error
-
Re: int arguments
If you get an error, you'd best show it to us. We're terrible at reading minds.
- 01-09-2013, 04:40 AM #5
Member
- Join Date
- Jan 2013
- Posts
- 4
- Rep Power
- 0
Re: int arguments
Sorry, i thought you would see something wrong with that method, i've only been learning over the past couple of weeks, so i finding this very difficult
the error is: java.lang.NoSuchMethodError
-
Re: int arguments
What line causes this error to occur? Is it the two method calls inside of your method? If so, you need to know what the variable type of object1 and object2 are, and only call legal methods for those variables. Again, we're missing information here and can only help us as well as you let us.
- 01-09-2013, 04:54 AM #7
Member
- Join Date
- Jan 2013
- Posts
- 4
- Rep Power
- 0
Re: int arguments
java.lang.NoSuchMethodError:
moving.moveToPosition(II)V
in (Workspace:1)
when i use 1 int value in the header it works, but when i use 2 int values, i get this errorLast edited by batousai; 01-09-2013 at 04:59 AM.
- 01-09-2013, 02:09 PM #8
AN21XX
- Join Date
- Mar 2012
- Location
- Munich
- Posts
- 297
- Rep Power
- 2
Re: int arguments
I am a little less perceptive than Fubarable... could you please post the whole code segment, that is at least the complete method/class and the complete error message...
I like likes!.gif)
- 01-09-2013, 03:06 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
Re: int arguments
That must be a runtime error, because Javac (the compiler) never shows the signatures of methods in their internal form (II)V; it is trying to tell you that no method returning void (V), that takes two int parameters (II) exists. The method you showed us in your OP wasn't actual code which is very confusing. Always show us the actual code that is giving you problems and show the actual error messages as well.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
vm arguments
By mharsijamel in forum NetBeansReplies: 4Last Post: 01-02-2012, 12:40 PM -
Arguments
By maya700 in forum New To JavaReplies: 12Last Post: 02-01-2011, 05:57 PM -
help with arguments
By smilinglady in forum New To JavaReplies: 33Last Post: 01-27-2011, 03:10 AM -
Sorting objects with 2 strings arguments and 2 int arguments
By tirwit in forum New To JavaReplies: 8Last Post: 09-23-2010, 12:07 AM -
Passign arguments
By ninjalord918 in forum AWT / SwingReplies: 4Last Post: 08-03-2010, 11:11 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks