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)