為什么System.out.println后括號(hào)里的冒號(hào)不能加?
例如System.out.println("three = one + two ==> "+three);
能不能加冒號(hào)變成System.out.println("three = one + two ==> :"+three);?
為什么?
例如System.out.println("three = one + two ==> "+three);
能不能加冒號(hào)變成System.out.println("three = one + two ==> :"+three);?
為什么?
2016-08-29
舉報(bào)
2016-08-29
可以運(yùn)行出結(jié)果的,只是第二種會(huì)把:放在里面
2016-08-29
可以加啊,輸出為three = one + two ==> :three
2016-08-29
樓上說的已經(jīng)很清楚了,混個(gè)臉熟
2016-08-29
比如說:three=3,那么
System.out.println("three = one + two ==> "+three);輸出是
three = one + two ==> 3
而System.out.println("three = one + two ==> :"+three);輸出是
three = one + two ==> :3
2016-08-29
雙引號(hào)("")中的內(nèi)容是一字符串,你可以隨意設(shè)置,不加引號(hào)的部分是一些變量、常量等定義過的東西,他們之間通過加號(hào)(+)連接。希望可以幫到你。
2016-08-29
可以加啊,是一個(gè)字符串,加了難道會(huì)報(bào)錯(cuò)?