class Base{
public void func1(){
System.out.println("Base::func1");
}
public static void funcstatic(){
System.out.println("Base::func1_static");
}
}
class Derived extends Base{
public void func1(){
System.out.println("derived::func1");
}
public static void funcstatic(){
System.out.println("derived::func1_static");
}
}
public class Test{
public static void func(StringBuffer x,StringBuffer y){
x.append(y);
y=x;
}
public static void main(String[] args) {
StringBuffer x=new StringBuffer("A");
StringBuffer y=new StringBuffer("B");
func(x,y);
System.out.println(x);
System.out.println(y);
Base p=new Derived();
p.func1();
p.funcstatic();
Derived d=new Derived();
d.func1();
d.funcstatic();
}
}
AB
B
derived::func1
Base::func1_static
derived::func1
derived::func1_static