public class OperationExample {
public static void main(String[] args) {
char c1 = 'a';
char c2 = 'a' + 1;
// char c2 = c1 + 1; <- compile error
System.out.println(c2);
}
}
The first statement which declares c2 can be compiled, but the second one cannot be compiled. I heard that the factor for this difference is about literal, but I cannot understand this phenomenon exactly.
Can you give me an explanation for this situation?