2.4.9

Classes

Test yourself

Classes

A class is a blueprint for creating objects.

Illustrative background for What is a class?Illustrative background for What is a class? ?? "content

What is a class?

  • A class is a blueprint for creating an object.
  • One class will often represent one type of real-world object.
    • For example: in a snooker game you might have a 'Ball' class.
Illustrative background for What is inside a class?Illustrative background for What is inside a class? ?? "content

What is inside a class?

  • A class contains two main components:
    • Attributes: these are variables which describe the object.
    • Methods: these are subroutines which allow the object to perform actions.
Illustrative background for Classes in JavaIllustrative background for Classes in Java ?? "content

Classes in Java

  • Classes have different levels of visibility.
  • In Java, classes are created using the class keyword.
    • These classes can be made public (can be used in any part of the program) using the public class keywords.
  • The image above shows a Java class.

Jump to other topics

1Components of a Computer

2Software & Software Development

3Exchanging Data

4Data Types, Data Structures & Algorithms

5Legal, Moral, Cultural & Ethical Issues

6Elements of Computational Thinking

6.1Thinking Abstractly

6.2Thinking Ahead

6.3Thinking Procedurally

6.4Thinking Logically

6.5Thinking Concurrently

7Problem Solving & Programming

8Algorithms

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium