posted 14 years ago
Hello Sonia,
Here ASCII value of c = '99' whenever (12+'c') is considered as arithmetic addition operation. Hence the ASCII value of 'c'(99) is added with 12 which results 111.
Its very similar like if you assign int a = 'c'; then a value become 99. if you try to print a, 99 will be printed.
In the above, char is implicitly casted into int. Hence compilation error wont occur.
Here Character.getNumericValue('c') method returns the int value that the specified Unicode character represents.
Regards,
Antany