相信自己,只有不想做的,没有做不到的。
发布时间:2014-08-10 22:28:51
目标:掌握static自由块的使用源文件:Count.java/* * Static 初始化块(自由块的用法) * author guojing * e-mail guo443193911@126.com * * */package cn.com.Count;public class Count {private int serialnumber;public static int counter;static{Sys.........【阅读全文】
发布时间:2014-08-10 22:18:25
目标:掌握通过覆盖equals()方法的方式,来定义自定义对象相等的含义源文件:CellPhone.javapackage cn.com.CellPhone;public class CellPhone {//PIN 码String pin;public CellPhone(String pin){this.pin = pin;}public boolean equals(Object obj) {if (this == obj)return true;if (obj == null)re.........【阅读全文】
发布时间:2014-08-10 12:21:09
目标:掌握通过父类中的toString()方法,通过自定义的toString()方法返回的字符串来表示对象的方法。源文件:Person.javapackage cn.com.Person;public class Person {String name;int Age;String Sex;public void setName(String _name){//name = _name;this.name = _name;}public void setAge(.........【阅读全文】
发布时间:2014-08-10 11:52:10
目标:进一步了解自由块的运行机制源文件:Person.javapackage cn.com.Person;public class Person {String name;int age;String sex;public Person(){System.out.println("构造器Person()被调用");sex = "Male"; System.out.println("name=" + name +" age="+age+" sex="+sex);}public P.........【阅读全文】
发布时间:2014-08-10 10:06:50
目标:掌握如何在子类中覆盖父类的方法源文件:Person.javapackage cn.com.Animal;public class Animal {private int weight;public int getwight(){return weight;}public void setwight(int _weight){weight = _weight;}public Animal(int _wieght){System.out.println("重量为:"+_wieght);}}.........【阅读全文】