Monday, 12 October 2015

Widening and Narrowing conversion example in java


public class First {

public static void main(String[] args) {
// TODO Auto-generated method stub
char ch = 'A';
int i = ch;
System.out.println("The value of \"i\" is " +i);
int j = 66;
char cha = (char)j;
System.out.println("The value of \"j\" is " +cha);


}

}


output:-
The value of "i" is 65
The value of "j" is B

No comments:

Post a Comment