posted 13 years ago
In the above program, there are 2 contradicting scenarios for me.
Scenario 1
In the above program below line works fine.
char c [] = new char []{'\u0000', 'C', 'A', 65};
This means 65 which is an int, is some how (implicitly) converted to char and stored inside the char array.
Scenario 2
And, in the above program below line (now commented) gives me a compilation error.
new A().m(65);
This means, the method m() which takes a char input argument does not take an int literal as an argument. That means in this situation
the int value is not implicitly converted to char.
So, in scenario 1 - int is implicitly converted to char
in scenario 2 - int is not implicitly converted to char
why is this contradiciting behavior ?