• Java作业十(2017-11-8)


    public class TAutoPerson {
    	public static void main(String args[]) {
    		new TAutoPerson().fun();
    	}
    	public void fun() {
    		System.out.println("hello world!!!");
    	}
    }
    

      

    package com.baidu.www;
    
    public class Tperson {
        String name;int age;
        public Tperson(String name,int age) {
            this.name = name;
            this.age = age;
        }
        public boolean compare(Tperson 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
        	Tperson per1 = new Tperson("张三",30);
        	Tperson per2 = new Tperson("张三",30);
            if(per1.compare(per2)){
                System.out.println("是同个人!");
            }
        }
    }
    

      

    package com.baidu.www;
    
    public class Tperson {
        String name;int age;
        public Tperson(String name,int age) {
            this.name = name;
            this.age = age;
        }
        public boolean compare(Tperson 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
        	Tperson per1 = new Tperson("张三",30);
        	Tperson per2 = new Tperson("张三",30);
            if(per1.compare(per1)){
                System.out.println("是同个人!");
            }
        }
    }
    

      

    package com.baidu.www;
    
    public class Tperson {
        String name;int age;
        public Tperson(String name,int age) {
            this.name = name;
            this.age = age;
        }
        public void fun(Tperson temp){
        	temp.name="李四";
        	temp.age=33;
        	}
        public String getName() {
            return this.name;
        }
        public int getAge() {
            return this.age;
    }
        public static void main(String[] args) {
        	Tperson per=new Tperson("张三",30);
    		per.fun(per);
    		System.out.println(per.getName()+per.getAge());
    }
    }
    

      

    package com.baidu.www;
    
    public class Tperson {
        String name;int age;
        public Tperson(String name,int age) {
            this.name = name;
            this.age = age;
        }
    
        public String getName() {
            return this.name;
        }
        public int getAge() {
            return this.age;
    }
        public static void main(String[] args) {
        	Tperson per1=new Tperson("张三",30);
        	Tperson per2=new Tperson("张三",30);
    		if(per1.getName().equals(per2.getName())&&per1.getAge()==per2.getAge()){
    		System.out.println("是同一个人!");
    		}
    	}
    }
    

      

  • 相关阅读:
    浏览器的缓存机制
    浏览器渲染原理及优化
    flutter 安装 & 启动 windows
    从浏览器输入 url 到页面渲染
    压力测试简单案例
    Office2021简体中文离线安装包下载地址合集,目前最全! L
    pdfplumber yongqi
    MySQL中对varchar类型排序问题 yongqi
    基础知识串讲笔记2022124 yongqi
    Faker是一个Python包,,待学习 yongqi
  • 原文地址:https://www.cnblogs.com/chengxuyuanGM/p/7802949.html
Copyright © 2020-2023  润新知