zuai-logo

Glossary

A

Abstraction

Criticality: 2

The process of hiding complex implementation details and showing only the essential features of an object. It focuses on what an object does rather than how it does it.

Example:

When you use a remote control, you're using abstraction; you press a button to change the channel without needing to know the complex electronic signals involved.

D

Diamond Problem

Criticality: 1

A classic ambiguity that arises in programming languages that support multiple inheritance, where a class inherits from two parent classes that share a common ancestor, leading to uncertainty about which inherited method implementation to use.

Example:

Java avoids the diamond problem by disallowing a class from directly inheriting from more than one superclass.

Dynamic and Static Typing

Criticality: 2

Static typing refers to type checking at compile-time, while dynamic typing refers to type checking at runtime. In Java, variables have a static type (declared type) and an object has a dynamic type (actual type).

Example:

If you declare Animal myPet = new Dog();, Animal is the static type, and Dog is the dynamic type of myPet.

I

Inheritance

Criticality: 3

A mechanism in OOP where one class (subclass) acquires the properties and behaviors (methods and instance variables) of another class (superclass). It promotes code reusability and establishes an 'is-a' relationship.

Example:

A Car class might inherit from a Vehicle class, meaning a Car is a Vehicle and automatically gets properties like speed and color from Vehicle.

M

Method Overriding

Criticality: 3

A feature that allows a subclass to provide a specific implementation for a method that is already defined in its superclass. The method signature (name, parameters) must be the same.

Example:

A Cat subclass might override the makeSound() method inherited from Animal to specifically print "Meow!" instead of a generic sound.

O

Object-Oriented Programming

Criticality: 3

A programming paradigm based on the concept of 'objects', which can contain data and code. It emphasizes principles like inheritance, polymorphism, abstraction, and encapsulation.

Example:

In a game, you might use Object-Oriented Programming to model different types of characters, like a Player object and an Enemy object, each with their own properties (health, score) and behaviors (move, attack).

P

Polymorphism

Criticality: 3

The ability of an object to take on many forms, allowing an object to be called by its own class type or by its superclass type. It enables a single interface to represent different underlying forms.

Example:

You could have a list of Animal objects, but some might be Dogs and others Cats; calling the makeSound() method on each will result in different sounds due to polymorphism.

S

Subclass

Criticality: 3

A class that inherits properties and methods from another class (its superclass). It is also known as a child class or derived class.

Example:

If Vehicle is a superclass, then Car and Motorcycle would be subclasses, inheriting common vehicle characteristics.

Superclass

Criticality: 3

A class whose properties and methods are inherited by other classes. It is also known as a parent class or base class.

Example:

In a hierarchy where Dog and Cat are types of Animal, Animal would be the superclass.

T

The Object Superclass

Criticality: 2

The `Object` class is the root of the class hierarchy in Java; every class implicitly inherits from it. It provides basic methods like `equals()`, `hashCode()`, and `toString()`.

Example:

Even a simple MyClass you create implicitly inherits from Object, meaning you can call myObject.toString() without explicitly defining it.

The super Keyword

Criticality: 2

A keyword used in a subclass to refer to members (constructors, methods, or instance variables) of its immediate superclass.

Example:

Inside a Dog subclass constructor, **super**("Buddy") might call the Animal superclass constructor to set the animal's name.

e

extends keyword

Criticality: 3

A keyword used in Java to indicate that a class is inheriting from another class, establishing an inheritance relationship.

Example:

public class Dog **extends** Animal { ... } shows that Dog is a subclass of Animal.