Answer the question
In order to leave comments, you need to log in
What is the best way to write java class inheritance?
Good day.
class Parent {}
....
Parent p = new Parent() {
public void Hello() {}
}
class Parent {}
class Child extends Parent {
public void Hello() {}
}
Answer the question
In order to leave comments, you need to log in
No, it's not different. In both cases, the compiler will save completely identical bytecode to class files. The only difference is that in the first case, the compiler will generate a class name of the form External_class_name$Internal_class_number .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question