11.10 电脑更新没应用文件,图片下次补
1 .packagecty;
public class StaticDemo
{
public static void main(String args[])
{
new StaticDemo().fun();
}
private void fun() {
System.out.println("XXXXXXXX!!");
}
}
2.packageCTY;
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;
}
}
3.package CTY;
public class CRL {
public static void main(String args[]) {
RL r1 = new RL("XX",30);
RL r2 = new RL("XX",30);
if(r1.compare(r2))
{
System.out.println("SAMEXX!!");
}
}
}
4.package CTY;
public class aa {
private int age;
private String name;
public aa(String name,int age) {
this.name =name;
this.age =age;
}
public boolean compare(aa 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;
}
}
5.
packageCTY;
public class Person {
private String name;
private String age;
public Person(String name,String i)
{
this.name=name;
this.age=i;
}
public Person(String name2, int i)
{
}
public String getName() {
return this.name;
}
public String getAge()
{
return this.age;
}
};