Write the output for the following
i) char c = ‘A’ ;
int m = 26 ;
int n = c + m ;
System.out.println(“ n = “ +n) ;
Answers
Answered by
1
i) n= 88
----------------------------------
Answered by
1
When you are performing operation on
different data types then
lower data types are automatically converted to
higher data type in java
so here char will be converted to int by Ascii
value which is 65 of 'A'
and short wil be converted to int with value
unchanged
now
n=c+m
n=65+26 =91
Similar questions