Character data type

if c is a character variable, c=48; c=45+35 are valid because there is implicit conversion from int to char. but c=c+2; is not valid , we should perform there explicit conversion. my question is why implicit conversion not performed as I am already taken c as input character already.

A few definitions to start with:

Converting an int to char is called a narrowing primitive conversion, because char is a smaller type than int.

‘A’ + 1 is a constant expression. A constant expression is (basically) an expression whose result is always the same and can be determined at compile-time. In particular, ‘A’ + 1 is a constant expression because the operands of + are both literals.

A narrowing conversion is allowed during the assignments of byte, short and char, if the right-hand side of the assignment is a constant expression:

In addition, if the expression [on the right-hand side] is a constant expression of type byte, short, char, or int:

A narrowing primitive conversion may be used if the variable is of type byte, short, or char, and the value of the constant expression is representable in the type of the variable.
c + 1 is not a constant expression, because c is a non-final variable, so a compile-time error occurs for the assignment. From looking at the code, we can determine that the result is always the same, but the compiler isn’t allowed to do that in this case.

One interesting thing we can do is this:

final char a = ‘a’;
char b = a + 1;
In that case a + 1 is a constant expression, because a is a final variable which is initialized with a constant expression.

You should understand and remember this concept! You may go through the video again for that.