亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

java中整數(shù)數(shù)值默認(rèn)是int類型,這句話正確嗎?
高洛峰
高洛峰 2017-04-18 10:51:57
0
5
1178

比如byte b = 1; char c = 1;,如果整數(shù)類型默認(rèn)是int類型的話,那么byte b = 1;應(yīng)該需要強(qiáng)轉(zhuǎn)換才對(duì),因?yàn)閕nt是高精度的,但這里明顯不報(bào)錯(cuò),這是為什們呢?

高洛峰
高洛峰

擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗(yàn)。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項(xiàng)目經(jīng)理、高級(jí)軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...

reply all(5)
迷茫

First of all, the integer type defaults to int. There is no doubt about this.
Secondly, within the allowed type range, here byte: -128~127
And the integer int 1 is in this range, the compiler will automatically perform downward conversion of the constant.
If the constant exceeds this range, the compiler will directly report an error.

Peter_Zhu

Byte, short, char, and boolean are all processed as int at the bottom layer

Peter_Zhu

Wrong, two integers are added together. If it is less than or equal to int, the default is int. If one of them is long, the default is long;

You try to declare two byte variables, and then add them and assign them to another byte variable. The compiler will prompt an error and forced type conversion is required

洪濤

Check this article: http://www.programgo.com/arti...

阿神

Divided into automatic conversion and forced conversion

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template