关于extends的一个小问题
package Object;public class Detergent extends Cleanser{
public void scrub()
{
append("Detegent.scurb()");
super.scrub();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Detergent x = new Detergent();
x.dilute();
x.scrub();
System.out.println(x);
System.out.println("askjdjasdljal");
Cleanser.main(args);
}
}
class Cleanser
{
private String s = "Cleanser";
public void append(String a)
{
s = s+a;
}
public void dilute()
{
append("dilute()");
}
public void scrub()
{
append("scurb()");
}
public String toString()
{
return s;
}
public static void main(String[] args)
{
Cleanser x = new Cleanser();
x.dilute();
x.scrub();
System.out.println(x);
}
}