Using Operators and Decision Constructs Flashcards

1
Q

Only String, byte, char, short, int, (and their wrapper classes Byte, Character, Short, and Integer), and enums can be used as types of a switch variable.

A

+

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

The case constants must be assignable to the switch variable. For example, if your switch variable is of class String, your case labels must use Strings as well.

A

+

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

A boolean cannot be used for a switch statement. It needs an integral type, an enum, or a String.

A

+

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

A char value can ALWAYS be assigned to an int variable, since the int type is wider than the char type

A

+

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

Although it is not required for the exam to know the integral values of characters, it is good to know that all English letters (upper case as well as lower case) as well as 0-9 are below 127 and so are assignable to byte.

A

+

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

o1 and o2 denote two object references to two different objects of the same class.

A

The == operator compares whether the two references are pointing to the same object or not.

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

The concept is: || and && are short circuiting operation i.e. if the value of the expression can be known by just seeing the first part then the remaining part is not evaluated while | and & will always let all the parts evaluates.

A

+

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