Free Online Flashcard Deck

7 Objects and Classes Free Online FlashCards

Study 7 Objects and Classes with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is an object in Java?

Back

An object is a distinct entity created at runtime that combines state, behavior, and identity.

02
Front

What is a class in Java?

Back

A class is a blueprint and reference type that defines the data and operations its objects can have.

03
Front

What three properties characterize an object?

Back

State is an object's current information, behavior is what it can do, and identity makes it a distinct object.

04
Front

What is a field?

Back

A field is a variable declared inside a class that stores information associated with an object or the class.

05
Front

How do instance and static fields differ?

Back

An instance field has a separate value in each object; a static field has one shared value associated with the class.

06
Front

What does encapsulation accomplish?

Back

Encapsulation protects internal state by restricting direct access and exposing controlled public methods that enforce valid operations.

07
Front

What is a method?

Back

A method is a named block of code in a class that performs an action, changes state, or returns information.

08
Front

What does a Java constructor do?

Back

A constructor initializes a new object's fields. It has the class name, no return type, and runs when `new` creates the object.

09
Front

What happens in `BankAccount account = new BankAccount(...);`?

Back

`BankAccount account` declares a reference variable; `new BankAccount(...)` creates an object; `=` stores that object's reference in the variable.

10
Front

What does `this` refer to in Java?

Back

Inside an instance method or constructor, `this` refers to the current object.

11
Front

What is constructor overloading?

Back

Constructor overloading means defining multiple constructors in one class with different parameter lists.

12
Front

What does `null` mean for a class-type variable?

Back

`null` means a class-type variable refers to no object. Calling a method through it causes a `NullPointerException` at runtime.