Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Someone Please, Help.. having Syntax problems with p.getx().. PLEASE

 
greg layfield
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prog3.java:30: cannot resolve symbol
symbol : method getx ()
location: class Point
p.getx(); //getting x and y to use in the movements
^
Prog3.java:31: cannot resolve symbol
symbol : method gety ()
location: class Point
p.gety();

theres my two errors i am getting mostly
p.getx();
p.gety();
thats all i have in my code.. whats wrong?
 
Rich Raposa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Capitalize the "X" and "Y". The methods are getX() and getY().
Java is sensitive that way.
 
greg layfield
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks... i did that and it corrected it.. but now i am getting this:

Prog3.java:34: cannot resolve symbol
symbol : variable X
location: class Prog3
g.drawLine(X, Y, X, Y - 1);

heres my method:
public void move(int dir, Point p, Graphics g)
{
getX(); //getting x and y to use in the movements
getY();

if(dir == 0)
g.drawLine(X, Y, X, Y - 1);
p.setPoint(X, Y);

if(dir == 1)
g.drawLine(X, Y, X + 1, Y - 1);
p.setPoint(X, Y);

if(dir == 2)
g.drawLine(X, Y, X + 1, Y);
p.setPoint(X, Y);

if(dir == 3)
g.drawLine(X, Y, X + 1, Y + 1);
p.setPoint(X, Y);

if(dir == 4)
g.drawLine(X, Y, X, Y + 1);
p.setPoint(X, Y);

if(dir == 5)
g.drawLine(X, Y, X - 1, Y + 1);
p.setPoint(X, Y);

if(dir == 6)
g.drawLine(X, Y, X - 1, Y);
p.setPoint(X, Y);

if(dir == 7)
g.drawLine(X, Y, X - 1, Y - 1);
p.setPoint(X, Y);
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you not need int X = p.getX(); ? ( Similarly for Y )
Hard to say what you need to do because there's not enough program listed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic