Choose a right statement, int a 1 point
= 10 + 4.867;
O
a = 10
O
a = 14.867
O
a = 14
O compiler erro
Answers
Answered by
0
The 3rd option that is a = 14 is correct.
- While Integer is a Wrapper class in Java, int is a primitive data type.
- Due to its status as a primitive data type, int has limited flexibility. It can only be used to hold an integer's binary value.
- Integer allows us additional versatility in storing, converting, and manipulating an int data because it is a wrapper class for int data types.
- Since integer is a class, it has access to all of the built-in methods that are listed in the class. Similar to any other reference (object) type, integer-type variables store references to integer-type objects.
Here, int a = 10 + 4.867;
Now, since a decimal number assigned to an integer type variable, the number is rounded to a whole number.
Hence, the answer will be a = 14.
Hence, the 3rd option that is a = 14 is correct.
Learn more here
https://brainly.in/question/2767821
#SPJ9
Similar questions