When it converts to int implicitly - the result is obvious, but when it adds bytes - it`s different, why?
Asked
Active
Viewed 49 times
-1

Vita
- 55
- 7
-
3Please post the actual code, not images of code. – Rufus L Nov 30 '22 at 18:29
-
what is the difference, if the question is clear? – Vita Nov 30 '22 at 19:00
-
Code in an image cannot be copied and pasted to reproduce an issue. Also, screenreaders can't read the contents for visually impaired people. – Rufus L Nov 30 '22 at 19:03
-
oh, ok, I just thought my code was too easy to copy)) but I got you – Vita Nov 30 '22 at 19:05
-
1Yep, in this case it wasn't too bad (except for the folks who rely on a screen reader), but in general it's a good practice. – Rufus L Nov 30 '22 at 19:07
1 Answers
4
Your code just overflows byte
— it supports integer values from 0 to 255. You should use at least short
.

SNBS
- 671
- 2
- 22