Java Output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java Output

Hi im A learner wants to learn and take notes on challenge questions guess at least 5 a day if its okay to you guys can you guys explain to me what happens to this code?need a clearer insight.tnx in advance😀 i actually expected 100 is the answer because i is not initialized with a value https://code.sololearn.com/c2BL7cwqTsED/?ref=app

17th Apr 2018, 10:06 PM
Challenge Quest
Challenge Quest - avatar
6 Answers
+ 1
inValue() returns the int's value. The double takes the int's value on line 6 and turns it into a double.
17th Apr 2018, 10:25 PM
TurtleShell
TurtleShell - avatar
+ 2
At line 7 (the print statement) the two values are being added together thats why its 200 not 100
17th Apr 2018, 10:17 PM
TurtleShell
TurtleShell - avatar
0
tnx,but i guess i need more info what does intValue() method does?
17th Apr 2018, 10:21 PM
Challenge Quest
Challenge Quest - avatar
0
its downcasted right?
17th Apr 2018, 10:26 PM
Challenge Quest
Challenge Quest - avatar
0
yup
17th Apr 2018, 10:27 PM
TurtleShell
TurtleShell - avatar
0
thank you!noted📖📃
17th Apr 2018, 10:28 PM
Challenge Quest
Challenge Quest - avatar