第5章面向对象高级特性分解.ppt

测验 class Test { public static void main(String args[]){ Person p1=new Person(李娜,1982); Person p2=new Person(彭帅,1986); if(p1.getBirth()p2.getBirth()) System.out.println( p1.getName()+比+ p2.getName()+年龄大); } } 请写出Person类的定义。 第五章 面向对象高级特性 2015-10-13 5.1 变量多态 5.2 非访问控制符 5.2.1 static 1.类变量/静态变量 【例5-8】 public class scope{ static int a; int b; public static void main(String args[]){ a++; scope s1 = new scope(); s1.a++; s1.b++; scope s2 = new scope(); s2.a++; s2.b++; sc

文档评论(0)

1亿VIP精品文档

相关文档