zoukankan      html  css  js  c++  java
  • 10



    1

    package cn.ch.w; public class StaticDemo { public static void main(String args[]) { new StaticDemo().fun(); } private void fun() { // TODO 自动生成的方法存根 System.out.println("JAVA程序语言设计"); } }

    package nn;
    public class RL{
        private String name;
        private int age;
        public RL(String name,int age){
            this.name =name;
            this.age =age;
        }
        public boolean compare(RL r) {
            if(this.name.equals(r.name)&&this.age==r.age) {
                return true;
                }else {
                    return false;
                    }
        }
        public String getName() {
            return this.name;
            }
        public int getAge() {
            return this.age;
            }
    }

    package nn;
    
    public class CRL {
        public static void main(String args[]) {
            RL r1 = new RL("张三",30);
            RL r2 = new RL("张三",30);
            if(r1.compare(r2)) {
                System.out.println("r1和r2");
                System.out.println("是同一个人");
            }
        }
    
    }

     3

    package nn;
    
    public class ren {
        private int age;
        private String name;
        public ren(String name,int age) {
            this.name =name;
            this.age =age;
        }
        public boolean compare(ren l) {
            if(this==l) {
                return true;
            }
            if(this.name.equals(l.name)&&this.age==l.age) {
                return true;
                
            }else {
                return false;
            }
        }
        public String getName() {
            return this.name;
        }
        public int getAge() {
            return this.age;
        }
    
    }

    package nn;
    
    public class lei {
    
        public static void main(String args[]) {
            ren l1 = new ren("张三",20);
            ren l2 = new ren("张三",20);
            if(l1.compare(l1)) {
                System.out.println("是同一个人");
            }
            
    
        }
    
    }

    
    

     4

    package nn;
    class ee {    
            private String name;
            private int age;
            public ee(String name,int age) {
                this.name = name;
                this.age = age;
            }
            public void fun(ee te) {
                te.name ="lucy";
                te.age =23;
            }
            public String getName() {
                return this.name;
            }
            public int getAge() {
                return this.age;
            }
        }

    package nn;
    
    public class Cdmo {
    
        public static void main(String args[]) {
            ee son =new ee("tony",22);
            son.fun(son);
            System.out.println(son.getName() + "-->" +son.getAge());
    
        }
    
    }

    
    
    5

    package nn;
    public class qq {
        private String name;
        private String age;
        public qq(String name,String i){
            this.name=name;
            this.age=i;
        }
        public qq(String name2,int i) {
            
        }
        public String getName() {
            return this.name;
        }
    
        public String getAge() 
        {
            return this.age;
        }
    };
    package nn;
    public class sdf {
        public static void main(String args[]){
            qq per1 = new qq("理想",21);
            qq per2 = new qq("理想",21);
            {
                System.out.println("是同一个人!!");
            }   
        }
    };

    
    
    
    
    
  • 相关阅读:
    python-flask-SQLAlchemy
    python-flask-script定制manage命令
    python-flask框架
    python-flask-wtforms
    python-思路整理-虚拟环境
    python--django-admin定制页面流程:
    友盟iOS微信登陆没有回调的原因
    用同一个工程创建两个不同版本的应用
    简单方法实现手势解锁
    iOS开发中地图开发的简单应用
  • 原文地址:https://www.cnblogs.com/ninomiya617/p/7825454.html
Copyright © 2011-2022 走看看