What is the difference between using the short forms and the long forms in Java? Look at the following code:
char myChar = 'p';
myChar += 2;
myChar++;
myChar = myChar + 2;
System.out.println(myChar);
Line 2 and 3 work like expected. Line 4 gives the error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from int to char
I thought line 2 and 4 are the same. But the seem to be not the same?