Java的基本设定!

Integer Type

TypeStorage RequirementRange(Inclusive)
int4 bytes–2,147,483,648 to 2,147,483, 647
short2 bytes–32,768 to 32,767
long8 bytes–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
byte1 bytes–128 to 127

Floating-Point Types

TypeStorage RequirementRange(Inclusive)
float4 bytesApproximately ±3.40282347E+38F (6–7 significant decimal digits)
double8 bytesApproximately ±1.79769313486231570E+308(15 significant decimal digits)

Escape Sequences for Special Characters

Escape SequenceNameUnicode Value
\bBackspace\u0008
\tTab\u0009
\nLinefeed\u000a
\rCarriage return\u000d
\”Double quote\u0022
\’Single quote\u0027
\Backslash\u005c

注:编译器优先处理特殊符号,System.out.print(“\u002+\u002”);

Type Conversions

这里写图片描述

Operator Precedence

OperatorsAssociativity
[] . () (method call)Left to right
! ~ ++ – + (unary) - (unary) () (cast) newRight to left
,* / %
<< >> >>>Left to right
< <= > >= instanceofLeft to right
== !=Left to right
&Left to right
^Left to right

?…….| |Left to right|
|&&|Left to right|
?…… || |Left to right|
|?:|Left to right|
?…..= += -= *= /= %= &= |= ^= <<= >>= >>>= Left to right

Conversions for printf

Conversion CharacterTypeExample
dDecimal integer159
xHexadecimal integer9f
oOctal integer237
fFixed-point floating-point15.9
eExponential floating-point1.59e+01
gGeneral floating-point (the shorter of e and f
aHexadecimal floating-point0x1.fccdp3
sStringHello
cCharacterH
bbooleantrue
hHash code42628b2
tx or TxDate and time (T forces uppercase)Obsolete, use the java.time classes instead—see Chapter 6 of Volume II
%The percent symbol%
nThe platform-dependent line separator
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值