OOP - Week 2 Flashcards

1
Q

What is changing to a bigger or smaller type called

A

Widening/Narrowing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to type cast

A

Write (typename) infront of the variable name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an array

A

A container that holds a fixed number of values of a certain type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to make an array

A

(type) [] (arrayname) = new (type)[number]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to quickly initialise elements

A

(typename) [] (arrayname) = {values};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If syntax

A
if (condition) {
//code
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

While syntax

A
while (condition){
//code
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

do syntax

A
do {
//code
} while (condition);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

switch syntax

A
switch (expression)
{
case value 1: 
//code
break;
default:
//code
break;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

for syntax

A

for (i=start; i

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is block scope

A

A variable declared inside a pair of brackets in a method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Break and Continue

A

Break - breaks out of the loop

Continue - ends the current pass of the loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to make a for each loop

A
datatype [] arrayname = ...
for (datatype name : arrayname) {
//code
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Syntax of methods

A
public static datatype name (arguments) {
//code
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to make a method no output

A

public static void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly