Basierend auf der Tatsache, dass ein byte
Typ Java ist eine vorzeichenbehaftete 8-Bit two's complement Ganzzahl, warum funktioniert die zweite Art der Deklaration eines Bytes nicht?-128 als binäres Literal in Java
byte ok = -128;
byte notok = 0b10000000;
Mein Verständnis ist, dass 1000000
-128
sein sollte, aber Java gibt die notok
Variable oben sollte ein int
und kein byte
Meinten Sie, Byte hält 8 Bits? – Uli
@Mickey Nein, '+ 128'. –
@Uli Ja. Korrigiert :) –