How do you explain what type of object is the show in the code?

Viewed 7

when I create an interface object implementing the abstract methods (through anonymous classes). What type of object am I creating? with an example the question will be better understood

public class Class1{
    public static void main(String...args){
    Interface1 object1= new Interface1(){
    @Override
    public method1(){
    System.out.println("im the method");
    }
    }
System.out.println(Object1.getClass());
}

this returns the class Class1. how can you explain this?

an explanation of my doubt

0 Answers
Related