Section 1

Preview this deck

Polymorphism

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (8)

Section 1

(8 cards)

Polymorphism

Front

Polymorphism means to use an object like a variable. For instance a variable of a supertype can refer to a subtype object.

Back

Dynamic binding

Front

The JVM automatically uses the most specific method. It will keep looking throughout classes starting with the most specific class.

Back

Declared type and Actual Type

Front

A variable must be declared a type. A declared type is that which it was declared. EX: Object o = new GeometricObject(); The declared type is object. The actuel type is what the decalred types class, GeometricObject.

Back

Super keywork

Front

The super keyword enables you to use the constructors and methods of a super class within a subclass. If you wish to use the superclass constructors, you must use super keyword on the first line of the subclasses constructor. When constructing a subclass object the compiler first invokes the superclass before performing the subclass operations. When using the Super keyword to use a constructor of another class it is important to have a no argument constructor to prevent compile errors.

Back

subtype and supertype

Front

A class defines a type. A type defined by a subclass is called a subtype. A type defined by its superclass is called a supertype. You can say that Circle(class) is a subtype of the GeometricObject(Superclass) and that Geometric Object is(superclass) is a supertype for Circle(class).

Back

Inheritance

Front

Inheritance enables the reuse of software. It is to create a mother class,the "superclass", and let sub classes inherit features. Inheritance models the "is-a" relationship. A superclass "plant" would contain the subclass "sunflower" because a sunflower "is-a" plant. Java uses single inheritance.

Back

What are the three pillars of Object Oriented Programming?

Front

Encapsulation, inheritance and polymorphism.

Back

Method overriding

Front

When you use a superclasses methods if you change the methods they are then called overridden Methods. Static methods cannot be overridden. When overriding a method you can use the "@Override" notation. When overriding you must maintain the same return type. Do not confuse overriding with overloading. Overloading allows for several methods of the same name to except different data types.

Back