提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
静态字段与实例字段
public class IdentifyMyParts { public static int x = 7;/*from 时代Java公众号 - N o w J a v a . c o m*/ public int y = 3; static public void main(String[] args) { IdentifyMyParts a = new IdentifyMyParts(); IdentifyMyParts b = new IdentifyMyParts(); a.y = 5; b.y = 6; a.x = 1; b.x = 2; System.out.println("a.y = " + a.y); System.out.println("b.y = " + b.y); System.out.println("IdentifyMyParts.x = " + a.x); System.out.println("b.x = " + b.x);/** from 时代Java公众号**/ } }