IT114 Objects and classes and Lists

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

1/8

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:07 PM on 3/7/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

9 Terms

1
New cards

What are methods of an object called? What do they consist of?

Accessors
Consists of getters or readers, as well as setters or writers
Accessors = Readers + Writers

2
New cards

Which is private and which is public when talking about objects?

Public interface = methods
Private interface = data values

3
New cards

Difference between a homogeneous and heterogeneous object?

Homogeneous: all of

its data values are of the same type

Heterogeneous = Data values have different types (i.e strings, int, double, etc)

4
New cards

How is an object used in java? What is an example of this?

(1) Define a class to specify the object’s look

and feel

(2) Create objects using the new operator

along with references

Date d1; = declaration of variable for type Date (the class), a reference

d1 = new Date(); creates the object

5
New cards

How do you add items to a list 9not an array)? What method is used?

Name an example.

When does add items fail?

add(i, newitem)
Add a new item at a certain position (i)
i.e add(2, spaghetti) in a string list makes spaghetti be in position 2 while pushing the original value lower, which shifts some of the list

This fails if “i” is negative or beyond the size of the list

6
New cards

How do you remove items from a list? Can there be gaps in lists? When will remove fail?

remove(i), i being position of the item
After the item is removed, the list is shifted to the left to reposition.

There cannot be gaps in lists

Fails when there are no items in a list or when “i” is out of range, so the value must be greater or equal to 0 or less than the list’s size

7
New cards

How to get data from a list? What happens if the list is empty?

get(i), gets item from integer position i, returning a copy of this item. Restricted to 0 <= i < size.

Get fails

8
New cards

What are the operations divided into for lists? Where are the types of operations?

Readers and writers

reader: an op that does not affect the contents

of the list

writer: an op that does affect the contents

readers: size, isEmpty, and get
writers: add, remove (think of remove as an eraser)


9
New cards