Basic Java Programming

Average Rating
0 out of 5 stars. 0 votes.

Which of the following initialization statements is correct?

a. int number = 12.34;
Selected: b. int number = 1234; This answer is correct.
c. int number = “12.34”;
d. int number = “1234”;

Correct. An int should be initialized to a value having the same type. An int constant is made up of a sequence of digits.

Leave a Reply

Your email address will not be published. Required fields are marked *