Results 1 to 2 of 2
- 03-12-2012, 09:54 PM #1
Member
- Join Date
- Jan 2012
- Posts
- 26
- Rep Power
- 0
Why am i getting this error in my method?
Im getting a "Cannot invoke toString() on the primitive type int" error in the method toString(). I have tried changing the syntax and nothing looks wrong...any insight?
public class Point {
private int x;
private int y;
public Point(){
}
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public void move(int x, int y) {
move(x,y);
}
public void reposition(int x, int y) {
}
public String toString() {
x.toString();
y.toString();
}
}
- 03-12-2012, 10:12 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Similar Threads
-
Method- error?
By katiebear128 in forum New To JavaReplies: 7Last Post: 10-16-2011, 03:01 PM -
Runtime error in a method
By Pojahn_M in forum New To JavaReplies: 8Last Post: 08-02-2011, 04:23 AM -
what does this error method mean?
By berkeley in forum New To JavaReplies: 1Last Post: 06-03-2010, 11:19 AM -
No Such Method Error - simple
By n00b in forum New To JavaReplies: 9Last Post: 05-04-2010, 04:05 PM -
static method sparks error on overriding non-static method
By MuslimCoder in forum New To JavaReplies: 1Last Post: 02-10-2009, 10:03 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks