an abstract class cannot b instiated -- this is true
then in the code below- static A a1 = new A(2){....} -- how come holds.
pls clerefy.......
abstract class A {
private int x = 4;
private int y = 2;
public A(int i1) {x=i1;}
public int x() {return x;}
public void x(int x) {this.x = x;}
public int y() {return y;}
public void y(int y) {this.y = y;}
public void incY() {y++;}
public abstract int math();
}
class B {
static A a1 = new A(2) {
{incY();}
public int math() {return x()+y();}
};
public static void main(
String[] args) {
System.out.print(a1.math());
}
}