package android.java.oop11; // 描述Worker public class Worker { public String name; public int age; public void printlnNameAge() { System.out.println("name:" + this.name + " age:" + age); } }
package android.java.oop11; public class DemoTest { public static void main(String[] args) { Worker w = new Worker(); w.name = "鬼干"; w.age = 99; w.printlnNameAge(); } }
原文:https://www.cnblogs.com/android-deli/p/10351578.html