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