Which of the following data types will allow the following code snippet to compile?
Correct Answer: B,D
Option B and D are the correct answer. Since the variables I and j are floats, resultant will be float type too. So we have to use float or primitive type which can hold float, such a primitive type is double, it has wider range and also can hold floating point numbers, hence we can use double or float for the blank. As explained above options B and D are correct. long and int can't be used with floating point numbers so option A is incorrect. Option E is incorrect as it have smaller range and also can't be used with floating point numbers. hnpsy/docs.oracle.com/javase/tutorial/java/javaOO/variables.html
Question 32
Given the following code for a Planet object: What is the output?
Correct Answer: C
Question 33
Given: Which code fragment can replace the if block?
Correct Answer: D
Question 34
Given: And given the code fragment: What is the result?