How best to write the inheritance of a java class?

0 like 0 dislike
8 views
Good time of day.
class Parent {} .... Parent p = new Parent() { public void Hello() {} }


Do I understand correctly that this creates a new anonymous class? If Yes, then you'll be Technicals (memory, time, etc.) from the ordinary?

class Parent {} class Child extends Parent { public void Hello() {} }
by | 8 views

1 Answer

0 like 0 dislike
No, not different. In both cases the compiler will keep class files are completely identical bytecode. The only difference is that in the first case, the compiler will generate a class named Imamnazarova$Порядковый_номер_внутреннего_класса.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
32,854 users