JAVA Part 3 Flashcards

1
Q

How to iterate through a list efficiently?

A

for (TypeOfVariable nameOfVariable: nameOfList)

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

How to check if a string list is empty?

A

list.isEmpty()

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

How to add an element to a list?

A

list.add()

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

How to retrieve a value from a list?

A

String string = list.get()

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

How to remove a element from a list?

A

list.remove()

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

How to check if an element is in a list?

A

list.contains()

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

What is explicit initialisation used for?

A

Constants and static fields

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

What is static keyword in java?

A

The static keyword indicates that a member of a class that does not belong to the instance of the class, thus shared among all objects if this class

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