Doubt in equality operators


#1
	int myInt='A';
            char myChar='A';
	System.out.println(myInt == myChar);

Above code is giving output - true
I feel it should be false.
When I print System.out.println(myInt); it gives 65 and System.out.println(myChar); gives A.
So the output for System.out.println(myInt == myChar); should be false. isn't it?
Please help me to understand.

Replace this line with your code.

`


#2

char is a numeric data type, when printed the corresponding character is shown. The ascii value for 'A' is 65


#3

@ionatan : 65 is not equal to A so it should be false. am i right.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.