有关java 数据类型的问题

为什么如果打印 int x = 3/2 就可以是1 但是打印int x= 1.0就会报错?

就这样8不知道
浏览 710回答 1
1回答

慕慕5436299

HABBMSTNGGARLUDIBYXUHUGSYYYZYCMQEKGZVYZGTKXGEXJCGHNTUWWMYULCPAAAHOQQCSCIIBLVLMWYYREPPDRRWCSIFJTJWQNZXJTWQZJGGNIJJNDXDNKKMWJUGNOERERZJPIYPGPNANXGLRHYVEEXYKCVVISEKKBLLGPNNREQGUAOPPVLBWGGAUELROELRHKNBVZFIOPNKAHYXZVSIVCLVBZZIIRJPGNGQHXGFYVIVVOPSXAGWSKULIZJMUTDMQXUEUERNTBAEUEEBBPOKZPXAHSFZBHGTMZHXGUVBDDZZMSQXXHDHUGTDTMMGELBUNXJGSMJKKURAKBRDGCAKQCIIVJWMWQJONWNJOKHLZXVEEUDUEXXPIMFSLPZMMPJWBHDXXGJJGTUBAJJWJCMEIMCSOSOCRZMMJMVBLEDKGDNGKGZZREUKUHJWJVMVFLBSIIOOQXGDPPCYYGOUTHKXXQKXQZFNTHHOVMMQWJTCKGMZWDZBAHYYYEEVVILXHRUQRYMFZYLEBVKHNBYBLKRXKXDKRHKNGWTGIUXEFTUUKXETAQKKEBNDNNGRXTTBKLLZVPZIPMGCOQANKDNNROXDXXUUHXIQFVXTDGHQAQUVLADGWTHRHYAQZCFBKADTVTVYHRBEGKBKDRHEHEBRHSCFCKMVSBXNXHWTBYHXFIYVSIEAQGWSIRDMTPMIMPFVLIDJSHDTQTIFBL

慕用8387691

int是整型类型,1.0是浮动类型,改成 double x= 1.0;   就可以了
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java