+ 2

In java,when System.out.println{12345+5432l} output is 17777.In these case L is char or string.and can sum with integers?

what is possible ans?

14th Jul 2017, 3:07 AM
Aye Chan Ko
Aye Chan Ko - avatar
7 ответов
+ 5
??? Can you show me a code with that?
14th Jul 2017, 3:14 AM
MrCoder
MrCoder - avatar
+ 5
Ohh the same as rust fn main() { let x = 10i32; }
14th Jul 2017, 3:19 AM
MrCoder
MrCoder - avatar
+ 3
You used the wrong bracket :>. Anyway, L will make the number of type long. So, 5432L is a long with the value of 5432. Adding the numbers together gives you 17777. Of type long. That's really it. It's the same as doing: float a = 12.5f; // 12.5 is a float double b = 0.5; // 0.5 is a double print(a+b); All regular whole numbers are by default of type int. So, the L was used to indicate that it is actually a long.
14th Jul 2017, 3:19 AM
Rrestoring faith
Rrestoring faith - avatar
+ 2
Or: double var = 5 * 3d; // 15.0 (d -> double)
14th Jul 2017, 9:45 AM
Boris Batinkov
Boris Batinkov - avatar
+ 1
thank u for ur ans
14th Jul 2017, 8:19 AM
Aye Chan Ko
Aye Chan Ko - avatar
+ 1
@MrCoder What's the i supposed to be? Int is the default whole number, there is no need for i.
14th Jul 2017, 3:42 PM
Rrestoring faith
Rrestoring faith - avatar
0
@Restoring faith Late reply lol, Declaring numbers in Rust is unpredictable, it can be f32, i32, i64, i8, and many more
24th Dec 2017, 5:52 AM
MrCoder
MrCoder - avatar