When performing arithmetic operations with values of type byte, char, short they are implicitly converted into the type int. Therefore, the result of the expression b + 1 will also be of type int. For it to be able to be assigned to a variable k, you need to use explicit type conversion:
byte k = (byte)(b + 1);
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать