levo

Defining Data: Types, Variables and Classes

Objects as occurrences of a class

  • 3 things to know
  • AS Unit 1
Start revising · £5/month

Overview

Saying that an object is an occurrence of a class, term for creating an object from a class and state of an object.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What is meant by saying that an object is an occurrence of a class?

Key term

Two objects of the same class hold entirely different data. Explain how one class definition supports that.

Key term

What is a class?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is a class?

    Model answer

    A class is a template that defines the attributes and methods shared by a whole category of things, without holding any data of its own for a particular member of that category.

  2. 2

    What is an object?

    Model answer

    An object is a single occurrence of a class, created at run time, holding its own values for the attributes the class defines.

  3. 3

    What is meant by saying that an object is an occurrence of a class?

    Model answer

    The class states what every member of the category has and can do, and each object is one actual member built to that pattern, so the class is written once and the objects created from it may be many.

  4. 4

    What is the term for creating an object from a class?

    Model answer

    Creating an object from a class is called instantiation, and the object produced is an instance of that class.

  5. 5

    In the Java statement Account a = new Account("Ali", 250); name the class, name the reference variable and state what the keyword new does.

    Model answer

    The class is Account, the reference variable is a, and the keyword new allocates memory for a fresh Account object and runs the constructor to set it up.

  6. 6

    Why can one class have many objects while one object belongs to only one class?

    Model answer

    A class is a definition and can be used as the pattern for any number of instances, whereas each object is built from exactly one definition and takes its structure from it.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A null is the of one.
absencepresencetype

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Defining Data: Types, Variables and Classes, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.