Java OCA OCP Practice Question 783

Question

Which of the following do not compile when filling in the blank? (Choose two.)

long bigNum = ___; 
  • A. 1234
  • B. 1234.0
  • C. 1234.0L
  • D. 1234l
  • E. 1234L
  • F. 1_234


B, C.

Note

A long cannot contain a number with decimal points, preventing Options B and C from compiling.

Options D and E show you can force a number to be a long by ending it with an upper- or lowercase L.

This does not work if the number has a decimal point.

Option F shows how to use underscores to break up a number.




PreviousNext

Related