public class Main { public static void main(String[] args) { A a = () -> { System.out.println("Something"); }; B b = () -> { System.out.println("Something"); }; System.out.println(a.getClass()); System.out.println(b.getClass()); } } interface A { void abstractMethod(); } interface B { void abstractMethod(); }