Explain the working of the snippet | Sololearn: Learn to code for FREE!

+3

Explain the working of the snippet

System.out.println((byte) (417)); It outputs -95. Explain the calculations

7/7/2020 5:52:05 AM

Ayush Pandey

7 Answers

New Answer

+2

Ipang waiting for ur answer

+2

Ayush Pandey You changed the Description. I suspect that happens because 417 is out of data range of 'byte' which is around -128 ~ 127. That might be an effect of value overflow, but I'm not sure I can explain. This article covers overflow effect of `int` type, but I suppose the same thing can happen with `byte`. https://dzone.com/articles/overflow-and-underflow-data

+1

How does it evaluate to -95

0

Ayush Pandey That line does not even compile bro! Are you sure that is the complete code? or did you just write a portion of it?

0

Yeah I know you code man Don't get upset too quick though I didn't say you don't know the A's But that line, as it is, just trigger error That's all I'm saying ... lol

0

Danijel Ivanović May u explain me

-2

Ipang lol.... what do you think I dont even know The "A's " of coding.... anyways actually I wrote in the title that it is snippet which actually means a portion of whole code.... So actually I want to know the working of this piece.... For I know how to write codes XD