Which of the following options contain correct code to declare and initialize variables to store whole numbers?
I got all the answers right but I had an extra answer that would make my response incorrect according to this test.
is incorrect. Although, this obviously will compile and run.
double a5 = 0;
Are there tricky questions on the actual OCA exam like this? Where the code will compile and run but the question is looking for something very specific such as which data-types are designed specifically to store integers?
public void main String array,
- X 2
Roel De Nijs wrote:That's not a trick question! All words in the question matter. Question clearly states it should be a whole number. Although double a5 = 0; compiles and runs, it isn't correct because double is used to represent decimals (not whole numbers).
Roger. Thank-you kind sir for the helpful reply. I should of read this more carefully.