import java.util.*;
import java.lang.*;
import java.io.*;
class Base {
}
class A extends Base {
protected int a;
protected int b;
A (int a, int b) {
this.a = a;
this.b = b;
}
public String toString() {
return "A [" + a + ", " + b + "]";
}
}
class B extends Base {
protected int a;
protected int b;
B (int a, int b) {
this.a = a + b;
this.b = a - b;
}
public String toString() {
return "B [" + a + ", " + b + "]";
}
}
class Main {
protected static Base getB() {
return new B(10, 40);
}
public static void main(String[] args) {
System.out.println(getB());
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: