Ask 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 = 82;

E. String i = 82;

+3
Answers (1)
  1. 9 December, 21:42
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers