public class Virt {
static int a = 1;
static abstract class A {
abstract void foo();
}
static class B extends A {
void foo() {
a += a / 2;
}
}
static class C extends A {
void foo() {
a += 3;
}
}
public static void main(String[]args) {
bench();
}
static void bench() {
long t = System.currentTimeMillis();
//A y = new C();
A x = new B();
for (int i=0; i<100000000;i++) {
x.foo();
}
System.out.println(a);
System.out.println(System.currentTimeMillis() - t);
}
}