Apr. 26th, 2005
brave multiple inheritance in Java :p
Apr. 26th, 2005 10:23 pmlook...
package com.myjavatools.xml;
public class Untitled2 {
public static void main(String[] args) {
Untitled2 untitled2 = new Untitled2();
class A {
String a = null;
A(String seed) {
a = seed;
}
class B {
String b = null;
B(String seed) {
b = seed;
}
public String toString() {
return a + "/" + b;
}
}
B getB(String seed) {
return new B(seed);
}
}
class X {
String x = null;
A a = null;
X(String seed1, String seed2) {
x = seed1;
a = new A(seed2);
}
void doit(String seed) {
final String myString = "This is just a string";
A.B ab = a.new B(seed) {
public String toString() {
return super.toString() + ":" + x + "(" + myString + ")";
}
};
System.out.println(ab.toString());
}
}
new X("arg1", "arg2").doit("arg3");
}
}