OCA Java SE 8 Mock Exam 2 - OCA Mock Question 2


Which of the following lines will compile without warning or error?

  1. char d="d";
  2. float f=3.1415;
  3. int i=34;
  4. byte b=257;
  5. boolean isPresent=true;


C and E


A is incorrect because single quotes are used for character data.

B requires a suffix of f as in 3.14159f.

A byte accepts only the values from -128 to +127.