zoukankan      html  css  js  c++  java
  • 第十次作业

    public class Yi {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            new Yi().fun();
        }
        public void fun()
        {
            System.out.println("The untouchable ones are always stirring while the preferred ones all have nothing to fear.");
        }
    }

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

    public class T {
        String name;int age;
        public T(String name,int age) {
            this.name = name;
            this.age = age;
        }
        public boolean compare(T 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 T("ktt",18);
            T per2 = new T("ktt",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 = "ktt";
            temp.age = 18;
        }
        public String getName() {
            return this.name;
        }
        public int getAge() {
            return this.age;
        }
    public static class S {
        public static void main(String args[]) {
            Person per = new Person("tt"17);
            per.fun(per);
            System.out.println(per.getName() + "-->" + per.getAge());
            }
        }
    }
    class Pe {
        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 F {
       public void main(String args[]) {
           Pe per1 = new Pe("ktt",18);
           Pe per2 = new Pe("ktt",18);
           if(per1.getName().equals(per2.getName())&&per1.getAge()==per2.getAge()) {
               System.out.println("她们是同一个人!!");
           }
       }
    }

  • 相关阅读:
    程序员的进阶课-架构师之路(2)-数组
    程序员的进阶课-架构师之路(1)-数据结构与算法简介
    ASP.NET开发实战——(三)第一个ASP.NET应用《MyBlog》
    ASP.NET开发实战——(二)为什么使用ASP.NET
    ASP.NET开发实战——(一)开篇-用VS创建一个ASP.NET Web程序
    asp.net core 系列 12 选项 TOptions
    Linux编程 1 (文件系统路径说明, 目录结构说明)
    asp.net core 系列 9 三种运行环境和IIS发布
    asp.net core 系列 6 MVC框架路由(下)
    asp.net core 系列 4 注入服务的生存期
  • 原文地址:https://www.cnblogs.com/kongtingting/p/7824858.html
Copyright © 2011-2022 走看看