Ask Question
12 December, 12:27

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;

+1
Answers (1)
  1. 12 December, 14:26
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers