What is the output of the following code:
class Main {//from w w w .j a v a 2 s . c o m public static void main(String args[]) { char d = 1; int a = 0B0; double r = d | a; System.out.println(r); } }
1.0
We can use bit operation on char type.
The value one returned from d|a
is converted to double.