Java Job 10 (2017-11-8)

Source: Internet
Author: User
Tags stub

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 ("Zhang San", 30);    Tperson per2 = new Tperson ("Zhang San", +);        if (Per1.compare (Per2)) {            System.out.println ("is the same person! ");        }    }}

  

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 ("Zhang San", 30);    Tperson per2 = new Tperson ("Zhang San", +);        if (Per1.compare (Per1)) {            System.out.println ("is the same person! ");        }    }}

  

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= "John Doe";    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 ("Zhang San",;p er.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 ("Zhang San", +);    Tperson per2=new Tperson ("Zhang San"), if (Per1.getname (). Equals (Per2.getname ()) &&per1.getage () ==per2.getage () {System.out.println ("is the same person!") ");}}}

  

Java Job 10 (2017-11-8)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.