English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
if x is not an int variable, then x ++Type conversion is handled automatically because x = x + 1needs to be converted. See the following example.
public class Tester { public static void main(String args[]) { byte b = 2; //a type conversion must be performed //because1is an int while b is a byte variable b = (byte) (b + 1); System.out.println(b); byte b1 = 2; //is implicitly converted to type by the compiler b1++; System.out.println(b1); } }
Output Result
3 3