How to subclass in Eclipse?

During the lecture, my professor very quickly created a subclass in Eclipse.

As a result, the extend keyword is added to the subclass. I did not see which buttons he pressed.

Does anyone know where I should click? (I think he right-clicked on the current class in the package explorer, then New ==> class , then I forgot what to choose).

+9
java eclipse
source share
3 answers

When you browse the class you want to subclass, open the Type Hierarchy (press F4). Right-click on the parent-to-be class, and in the menu, go to the new → class (or Ctrl-n, class).

+16
source share

Right-click the project name on Package Explorer + Add New Class + Type package Name, Name (subclass name) and Super class (or click Browse to select the superclass).

0
source share

You can try to link the Keys for New command (new master: class) (for example, Ctrl + Alt + N), go to Window> Preferences> General> Keys.

And then in the new wizard window, change the Superclass field.

Hth.

0
source share

All Articles