Reputation: 287
How do I return the value of a Point function. Example:
public Point myFunction(int x, int y) {
return ???; // Want to return X and Y as a point.
}
I have no idea how the return should look. Help please.
Upvotes: 1
Views: 7086
Reputation: 251
Assuming you have a constructor that accepts x and y:
return new Point(x,y);
Upvotes: 0
Reputation: 13097
Have you tried:
public Point myFunction(int x, int y) {
return new Point(x, y);
}
What kind of point are you trying to make?
Upvotes: 7