11.06

复制代码
package top.hyself;

public class F$Demo {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new F$Demo().fun();

    }

    private void fun() {
        System.out.println("Hello World!!!");
    }

}
复制代码
复制代码
package top.hyself;

public class F$Demo {
    String name;int age;
    public F$Demo(String name,int age) {
        this.name = name;
        this.age = age;
    }
    public boolean compare(F$Demo per) {
        if(this == per) {
            return true;
        }
        if(this.name.equals(per.name) && this.age == per.age) {
            return true;
        }else {
            return false;
        }
    }
    public String getName() {
        return this.name;
    }
    public int getAge() {
        return this.age;
    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        F$Demo per1 = new F$Demo("cousins",26);
        F$Demo per2 = new F$Demo("cousins",26);
        if(per1.compare(per2)){
            System.out.println("是同个人!");
        }
    }
}
复制代码
posted @ 2017-11-20 10:17  Hyperion号  阅读(99)  评论(0)    收藏  举报