请这样写
public class point {
    public static void main(String[] args) {
        int x = 12, y = 12;
        String name = "start";
        point p = new point();
        p.print();
        p.move(50, 50, "moving");
        System.out.print("***after moving***");
        p.print();
    }
    void move(int newX, int newY, String name) {
        x = newX;
        y = newY;
        this.name = name;
    }
    void print() {
        System.out.println(name + ":x=" + x + " y=" + y);
    }
}谢谢

解决方案 »

  1.   

    现在有6个错误:C:\>javac point.java
    point.java:12: cannot resolve symbol
    symbol  : variable x
    location: class point
            x = newX;
            ^
    point.java:13: cannot resolve symbol
    symbol  : variable y
    location: class point
            y = newY;
            ^
    point.java:14: cannot resolve symbol
    symbol  : variable name
    location: class point
            this.name = name;
            ^
    point.java:17: cannot resolve symbol
    symbol  : variable name
    location: class point
            System.out.println(name + ":x=" + x + " y=" + y);
                               ^
    point.java:17: cannot resolve symbol
    symbol  : variable x
    location: class point
            System.out.println(name + ":x=" + x + " y=" + y);
                                              ^
    point.java:17: cannot resolve symbol
    symbol  : variable y
    location: class point
            System.out.println(name + ":x=" + x + " y=" + y);
                                                          ^
    6 errors
      

  2.   

    请问:JETA(I AM A JET.) 是什么意思,
    能具体点说吗?
      

  3.   

    我修改成了这样,你们认为这样行吗?
    public class point {
     int x = 12, y = 12;
          String name = "start";
        public static void main(String[] args) {
           
            point p = new point();
            p.print();
            p.move(50, 50, "moving");
            System.out.println("***after moving***");
            p.print();
        }
        void move(int newX, int newY, String name) {
            x = newX;
            y = newY;
            this.name = name;
        }
        void print() {
            System.out.println(name + ":x=" + x + " y=" + y);
        }
    }
      

  4.   

    public class point
    {int x=12,y=12;
    String name="start";
    public static void main(String[] args) 
    {


    point p = new point();
    p.print();
    p.move(50,50,"moving");
    System.out.print("***after moving***");
    p.print();
    }
    void move(int newX,int newY,String name){
    x=newX;
    y=newY;
    this.name=name;
    }
    void print()
    {
    System.out.println(name+":x="+x+" y="+y);
    }

    }
      

  5.   

    楼主要注意编写代码的规范,工整,逻辑性,这是很重要的。public class point
    {
             //把变量声明在所有函数之前,成为全局变量
    int x=12,y=12;
    String name="start";

             //这是主函数,程序执行的入口
    public static void main(String[] args) 
    {
    point p = new point();
    p.print();
    p.move(50,50,"moving");
    System.out.print("***after moving***");
    p.print();
    }

             //这是其他功能函数
    public void move(int newX,int newY,String name)
    {
    this.x=newX;
    this.y=newY;
    this.name=name;
    }

             //这是其他功能函数
    public void print()
    {
    System.out.println(name+":x="+x+" y="+y);
    }
    }
      

  6.   

    把x,y,name放在main 方法中时它只是局部变量,print,move方法是看不见它的明白吗。
      

  7.   

    还有像x,y,name 这样的实例字段最好定义成私有的