Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a subclass in Eclipse?

Tags:

java

eclipse

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

The result has the "extend" keyword added to the subclass. I didn't see what buttons he clicked.

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

like image 895
user133466 Avatar asked Sep 22 '11 01:09

user133466


People also ask

How do you create a subclass?

Creating a subclass can be as simple as including the extends clause in your class declaration (such as in the declaration in ImaginaryNumber above). However, you usually have to make other provisions in your code when subclassing a class, such as overriding methods.

How do you define a subclass?

Definition: A subclass is a class that derives from another class. A subclass inherits state and behavior from all of its ancestors. The term superclass refers to a class's direct ancestor as well as all of its ascendant classes.

How do you define a subclass in Java?

A class in Java can be declared as a subclass of another class using the extends keyword. A subclass inherits variables and methods from its superclass and can use them as if they were declared within the subclass itself: class Animal { float weight ; ... void eat () { ... } ... }

What is the difference between a class and a subclass?

Definitions: A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class).


1 Answers

Type your super class name where highlighted

Please see the picture where to enter your existing super class

like image 150
1234 Avatar answered Sep 27 '22 22:09

1234