How can I access this anonymous class method in Java and I getting error on below. What is the use of anonymous classes in Java? Can we say that usage of anonymous class is one of the advantages of java?
class Test1
{
public Test1()
{
System.out.println("Yes");
}
}
class Test extends Test1
{
public static void main(String []args) {
Test1 obj1= new Test1()
{
public void test1()
{
System.out.println("Yes A");
}
};
obj1.test1(); // here i am getting error
}
}