The AP Computer Science A 5-hour live stream review is here!Β πŸ’»

Join us on May 5, 2021 for the 🌢️ AP Computer Science A Cram Finale for a last minute review to get all your questions answered!

πŸ“š

All Subjects

Β >Β 

πŸ’»Β 

AP Comp Sci A

Β >Β 

πŸ“±

Unit 2

2.1 Using Objects Overview and 2.1 Instances of Classes

3 min readβ€’september 12, 2020

Peter Cao


The Big Takeaway Of This Unit

πŸ’‘Objects Objects are instances of classes and we can write methods to manipulate these objects.

Unit Overview

Exam Weighting

  • 5-7.5% of the test
  • Roughly 2 to 3 multiple-choice questions

Enduring Understanding

Java is what is known as an object-orientated programming language, or OOP for short. What is this object-orientated programming, and why is it so important to Java? This is the first of three units emphasizing object-orientated programming (the others are Units 5 and 9, covering classes and inheritance respectively). This unit, we will be learning about objects, the cornerstone of object-orientated programming, and what they are. There are four principles of object-orientated programming: abstraction (partly covered in this unit, also in Unit 5), encapsulation (covered in Unit 5), inheritance, and polymorphism (both covered in Unit 9).

Building Computational Thinking

In this unit, you'll learn how to write your first methods (functions in other programming languages), which perform a specific class. You'll also learn how to use methods from the Math and String classes, which will allow us to work more with numbers and text. These will make the foundations of all future units. Finally, you'll learn about objects, which are reference types: combinations of other data types that allow us to represent actual items and situations.

Main Ideas for This Unit

  • Making/Initializing Objects
  • Writing/Calling Methods
  • String Class
  • String Methods
  • Wrapper Classes
  • Math Class

2.1: Objects: Instances of Classes

Java is an object-orientated programming language, which means that most major programs in Java are about the manipulation of objects. What are objects? Objects are a reference type, which refers to how they are combinations of other primitive and reference data types. When you refer to them, you are not referring to the actual object itself, but where it is stored in data.
How do we know what combination of primitive and reference types each object has? This is due to the help of a class. A class is like a template that defines what an object is like and what the object can do. A class is basically the guidelines for a type of object, and an object is a particular instance of that class. We can think of a class as a blueprint for a house, and the object is a particular house. Different houses are different objects. The different houses may look different, but they have the same general features and functions. This is how classes and objects work.
However, an object is not a type of that class. For example, if the class is Fruit, Strawberry is not an object of Fruit, but it is only a subclass (we'll learn about this more in Unit 9). Objects of the Fruit class are specific items, so a specific strawberry or any other specific fruit are objects of the class. Meanwhile, Strawberry on its own is too broad since there are many individual strawberry objects that exist.

Was this guide helpful?

πŸ’ͺ🏽 Are you ready for the Comp Sci exam?
Take this quiz for a progress check on what you’ve learned this year and get a personalized study plan to grab that 5!
START QUIZ
FREE AP comp sci a Survival Pack + Cram Chart PDF
Sign up now for instant access to 2 amazing downloads to help you get a 5
Browse Study Guides By Unit
πŸ™
Exam Reviews
πŸ–±
Unit 10: Recursion
βž•
Unit 1: Primitive Types
πŸ–₯
Unit 3: Boolean Expressions and if Statements
πŸ•Ή
Unit 4: Iteration
βš™οΈ
Unit 5: Writing Classes
⌚️
Unit 6: Array
πŸ’Ύ
Unit 7: ArrayList
πŸ’»
Unit 8: 2D Array
πŸ–²
Unit 9: Inheritance
Join us on Discord
Thousands of students are studying with us for the AP Computer Science A exam.
join now