class TestFooBar {
public static Foo f = new Foo();
public static Foo f2;
public static Bar b = new Bar();
public static void main
(string [] args
) {
for (int x=0; x<4; x++) {
f2 = getFoo(x);
}
}
static Foo getFoo(int y) {
if ( 0 == y % 2 ) {
return f;
} else {
return b;
}
}
}
class Bar extends Foo {
void react
() { system.
out.
print("Bar ");
}
}
class Foo {
void react
() { system.
out.
print("Foo ");
}
}