In the following code, i was thinking there would be an error because of the line "new Calculate" because it is an abstract class. Why is this code working?
abstract class Calculate
{
abstract int multiply(int a, int b);
}
public class Main
{
public static void main(String[]args)
{
int result = new Calculate()
{
@Override
int multiply(int a, int b)
{
return a*b;
}
} .multiply(12,32);
}
}