Java Flashcards

1
Q

Is this following code valid:

float pi1 = 3_.1415F

A

Invalid, cannot put underscores adjacent to a decimal point

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

Is this following code valid:

long socialSecurityNumber1 = 999_99_9999_L

A

Invalid: cannot put underscores prior to an L suffix

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

Is this following code valid:

int x1 = 5_2;

A

OK

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

Is this following code valid:

int x2 = 52_;

A

Invalid: cannot put underscores at the end of a literal

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

Is this following code valid:

int x4 = 0_x52;

A

Invalid: cannot put underscores in the 0x radix prefix

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

Is this following code valid:

int x5 = 0x_52;

A

Invalid: cannot put underscores in the 0x radix prefix

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

Is this following code valid:

int x7 = 0x52_;

A

Invalid: cannot put underscores at the end of a number

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