Computer Applications
Define the following with an example:
coercion
Values & Data Types Java
53 Likes
Answer
In a mixed mode expression, when the data type of the result gets converted into the higher most data type available in the expression without any intervention of the user, is known as Implicit Type conversion or Coercion.
Example:
int a = 42;
long b = 50000;
long c= a + b;
Here, a is int, b is long so the result of a + b automatically gets converted into long and assigned to variable c which is of long type.
Answered By
34 Likes
Related Questions
Classify the following as primitive or non-primitive data types.
(a) char
(b) arrays
(c) int
(d) classes
In what way is static initialization of data type different from dynamic initialization?
Predict the return data type of 'r' and 'n' from the snippet:
int p; float m; r = p+m; n = m/3*(Math.pow(4,3)); System.out.println(r); System.out.println(n);Explain whether the following assignments are correct or not:
(a) int m =155;
(b) float f = 0.002654132;
(c) String str = 'Computer';
(d) boolean p = false;
(e) String b = "true";
(f) char ch = "apps";
(g) String st= "Application";
(h) double n = 455.29044125;