fieldaccessexample.java

来自「< Professional Java,JDK 5 Edition>」· Java 代码 · 共 30 行

JAVA
30
字号

class Point {
    public int x, y, z;

    public String toString()
    {
        return("(" + x + ", " + y + ", " + z + ")");
    }
}

public class FieldAccessExample {
    public native void transformPoint(Point p);

    static {
        System.loadLibrary("FieldAccessLibrary");
    }

    public static void main(String args[])
    {
        FieldAccessExample fae = new FieldAccessExample();
        Point p1 = new Point();

        p1.x = 17;
        p1.y = 20;
        p1.z = 10;
        System.out.println("The point before transformation: " + p1);
        fae.transformPoint(p1);
        System.out.println("The point after transformation: " + p1);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?