• 第十次作业


    public class Z {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            new Yi().fun();
        }
        public void fun()
        {
            System.out.println("Love is a carefully designed lie. ");
        }
    }

    public class Z {
        String name;int age;
        public Z (String name,int age) {
            this.name = name;
            this.age = age;
        }
        public boolean compare(K  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
            Z  per1 = new Z ("1",18);
            Z  per2 = new Z ("1",18);
            if(per1.compare(per2)){
                System.out.println("这俩人一个样~");
            }
        }
    }

    public class Z {
        String name;int age;
        public Z(String name,int age) {
            this.name = name;
            this.age = age;
        }
        public boolean compare(Z per) {
            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
            T per1 = new Z("1",18);
            T per2 = new Z("1",18);
            if(per1.compare(per2)){
                System.out.println("这俩人一个样~");
            }
        }
    }

     class Person {
        private String name;
        private int age;
        public Person(String name,int age) {
            this.name = name;
            this.age = age;
        }
        public void fun(Person temp) {
            temp.name = "1";
            temp.age = 18;
        }
        public String getName() {
            return this.name;
        }
        public int getAge() {
            return this.age;
        }
    public static class Z {
        public static void main(String args[]) {
            Person per = new Person("11"17);
            per.fun(per);
            System.out.println(per.getName() + "-->" + per.getAge());
            }
        }
    }


    class Z {
        private String name;
        private int age;
        public Pe(String name,int age) {
           this.name = name;
           this.age = age;
       }
       public String getName() {
           return this.name;
       }
       public int getAge() {
           return this.age;
       }
    }
    public  class Z {
       public void main(String args[]) {
           Pe per1 = new 1("Z",18);
           Pe per2 = new 2("Z",18);
           if(per1.getName().equals(per2.getName())&&per1.getAge()==per2.getAge()) {
               System.out.println("她们是同一个人!!");
           }
       }
    }


  • 相关阅读:
    【京东面试复盘】一面二面真题面经解析
    4个小技巧带你轻松入门kafka!
    python 函数
    python 文件修改
    python 文件基本操作
    python 集合的一些用法
    python 字典的应用_简单的三级列表
    python 字典的一些用法
    python 字符串的一些用法
    python 列表应用-简单的购物车
  • 原文地址:https://www.cnblogs.com/zhangliping123/p/7825209.html
Copyright © 2020-2023  润新知