Object Oriented Programming Term 2 Final

studied byStudied by 3 people
0.0(0)
Get a hint
Hint

inheritance

1 / 43

44 Terms

1

inheritance

allows new classes to be created based on existing classes, thus inheriting their properties and behaviour

New cards
2

superclass

class that can be extended to create a subclass; should not access the extra attributes and behaviours of a subclasssubclass

New cards
3

subclass

a class that extends a superclass and inherits its attributes and behaviours

New cards
4

pros of inheritance

code reusability, code maintenance, modularity (promotes breaking down code into smaller, specialized components)

New cards
5

cons of inheritance

tight coupling (difficult to modify base class without affecting derived class), fragile base class

New cards
6

conditional statement

a statement that only executes when a condition is true

New cards
7

while loop

executes a block of code repeatedly as long as a condition is true

New cards
8

iteration statement

statement that repeatedly executes a block of code

New cards
9

code for conditional statements

if (condition) {

code();

}

else {

code();

}

New cards
10

pros of OOP

  • modularity → makes code easier to modify and maintain

  • encapsulation → code doesn’t get modified accidentally

  • inheritance → reduces development time and increases quality of code

New cards
11

cons of OOP

  • not suitable for smaller projects

  • makes programs larger and slower

  • takes more time and effort

New cards
12

stack memory

holds variables and references to objects

New cards
13

heap memory

only holds objects

New cards
14

primitive data type

  • double: decimal value

  • int: whole numbers

  • boolean: true or false

New cards
15

reference data type

  • string

  • objects

New cards
16

declaration of a variable

giving a name and data type to a variable

New cards
17

initialization of a variable

giving a starting value to a variable using the assignment operator (=)

New cards
18

literal

a source code representation of a value f.e. binary representation

New cards
19

access modifier

used to set the visibility of classes, variables, constructors, and methods

New cards
20

instance variables

variables defined in a class where each variable represents an attribute of an object

New cards
21

precondition

a condition that must always be true before the execution of a code segment

New cards
22

postcondition

a condition that must always be true after the execution of a code segment

New cards
23

java.io package

contains classes for input and output

New cards
24

file class

used to read text files

New cards
25

hasNext()

returns true if there is another input

New cards
26

hasNextLine()

returns true if there is another line of input

New cards
27

hasNextInt()

returns true if there is another integer

New cards
28

for loop

a loop that repeats a code segment a given number of times

New cards
29

for loop code

for (int number = 0; number < 5; number++)

New cards
30

enhanced for loop

a for loop for traversing an array

New cards
31

enhanced for loop traversing code code

for (int number = 0; number < nums.length; number++)

New cards
32

enhanced for loop initialization code

int[] nums = {1, 2, 3, 4};

for ( int num : nums){

…}

New cards
33

1d array

a linear structure that holds one or more values of the same data type

New cards
34

element

an item stored in an array

New cards
35

off by one error

occurs when one tries to access an index value that is greater than the length of the array

New cards
36

polymorphism

the ability of an object to perform an action in different ways

New cards
37

initializing an array

DataType[] name = new DataType[length];

                                   int[] scores = new int[5];
New cards
38
New cards
39
New cards
40
New cards
41
New cards
42
New cards
43
New cards
44
New cards

Explore top notes

note Note
studied byStudied by 12 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 66 people
Updated ... ago
4.2 Stars(5)
note Note
studied byStudied by 15 people
Updated ... ago
4.0 Stars(1)
note Note
studied byStudied by 19 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 44 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 66 people
Updated ... ago
4.8 Stars(4)
note Note
studied byStudied by 260 people
Updated ... ago
4.5 Stars(4)

Explore top flashcards

flashcards Flashcard24 terms
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard44 terms
studied byStudied by 3 people
Updated ... ago
4.0 Stars(1)
flashcards Flashcard59 terms
studied byStudied by 14 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard28 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard46 terms
studied byStudied by 6 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard39 terms
studied byStudied by 21 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard32 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard23 terms
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)