Unit 4 - Class and Object-Oriented Programming

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

19 Terms

1
New cards

What is an object?

Something that has both state and behavior.

2
New cards

What are classes?

A template for creating an object.

3
New cards

What is an instance?

A specific version of a class. Instances and objects generally refer to the same thing.

4
New cards

What is the case difference between classes, objects, and instances?

Class names are capitalized (types).

When you create a specific version (instance/object), it’s lowercase.

5
New cards

What sentence relates classes, instances, and objects?

“An object is an instance of a class.”

6
New cards

What does it mean to be a client of the class?

When someone else creates a class and you can use the functionality of that class.

7
New cards

What is an instance variable?

A variable defined in a class for which each object of the class has its own copy, or instance

8
New cards

What are constructors?

A constructor allows us to create a new instance of a class, usually initializing instance variables.

9
New cards

What is an instance method?

An instance method is piece of code called on a specific instance of the class. It is called with a receiver object.

10
New cards

What is the general form of a method?

visibility returnType name(parameters)

11
New cards

What is the general form of calling an instance method?

receiver.methodName(parameters)

12
New cards

What are the two things that an object has?

State and behavior

13
New cards

What are getter methods / accessor methods used for?

They let you get access to some instance variables of an object.

14
New cards

What are setter methods / modifier methods used for?

They let you set the values of instance variables of an object.

15
New cards

What is a class variable?

A variable or attribute of a class common to all instances of a class.

16
New cards

What is a class method?

A method of a class common to all instances of a class, and is not called on an object instance.

17
New cards

Which of these is an example of calling a static method?

a) point.setX(x)

b) Math.abs(x)

c) student.getName()

d) square(x)

Math.abs(x)

18
New cards

What is method overloading?

Methods in a class can have the same name as long as their parameters are different

19
New cards

For method overloading, how should the method signatures be different?

1) Different types of parameters

2) Different ordering of parameter types

3) Different number of parameters