Bunun neden derlendiğini merak ediyorum? ve derlediğinden bu ne anlama geliyor?0xp0 baskıları 0.0 (Onaltılık Yüzer Noktalı Literal)
System.out.println(0xp0); // p?
ÇIKIŞ:
0.0
Bunun neden derlendiğini merak ediyorum? ve derlediğinden bu ne anlama geliyor?0xp0 baskıları 0.0 (Onaltılık Yüzer Noktalı Literal)
System.out.println(0xp0); // p?
ÇIKIŞ:
0.0
Bu bir kayan nokta hex literal.
özellikleri here bakınız. Sadece başvuru içinFor hexadecimal floating-point literals, at least one digit is required (in either the whole number or the fraction part), and the exponent is mandatory, and the float type suffix is optional. The exponent is indicated by the ASCII letter p or P followed by an optionally signed integer.
+1 Şey, ilk kez kayan nokta hex'i biliyorum. –
The JLS bunu açıklıyor:
HexadecimalFloatingPointLiteral:
HexSignificand BinaryExponent FloatTypeSuffixopt
HexSignificand:
HexNumeral
HexNumeral .
0 x HexDigitsopt . HexDigits
0 X HexDigitsopt . HexDigits
BinaryExponent:
BinaryExponentIndicator SignedInteger
BinaryExponentIndicator:one of
p P
yukarıdaki dayanarak, Yine de p
önce zorunlu .HexDigit
beklenebilir.
Benim için bu derleme değil, 'javactır 1.7.0_02' ile. Sadece '0x0p0' yapar. –
@TheGuyOfDoom '1.7.0_05' kullanıyorum. –
Güneş JDK'sındayım. Bu alakalı olabilir. –