Ask Question
26 January, 05:24

Which of the following variable declarations is a correct assignment?

A. int x = 97.2;

B. char c = 65.5;

C. String w = 82.4;

D. double y = 82;

E. String i = 82;

+3
Answers (1)
  1. 26 January, 07:17
    0
    Option D: double y = 82;

    Explanation:

    In Java programming, it is acceptable to assign an integer (lower type) to a double type (higher type) variable. By assigning an integer to double type variable using the "=" operator, the integer will be converted to double type implicitly. It is known as the implicit type casting.

    For example, double y = 82 will convert integer 82 (integer) to 82.0 (double).
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Which of the following variable declarations is a correct assignment? A. int x = 97.2; B. char c = 65.5; C. String w = 82.4; D. double y = ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers