Java OCA OCP Practice Question 2712

Question

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

a.  char d="d";
b.  float f=3.1415;
c.  int i=34;
d.  byte b=257;
e.  boolean isPresent=true;


c and e

Note

Option a is incorrect because single quotes are used for character data.

Option b requires a suffix of f as in 3.14159f.

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




PreviousNext

Related