+ 3

simple yet a slight twist..help here out?

Int y=7, sum=0; Sum=sum+y; Y=y+2; What is Y equal to?

23rd Aug 2017, 4:23 PM
Shalmi
Shalmi - avatar
5 Respostas
+ 4
9 Where is the twist? Or is sum being a distraction the twist?
23rd Aug 2017, 4:53 PM
AgentSmith
+ 4
I think the twist is that Y is in caps. So the answer is error! 😜
23rd Aug 2017, 5:24 PM
Rrestoring faith
Rrestoring faith - avatar
+ 4
int y=7,sum=0; //"int" bcz java is case sensitive , so "Int" will not work sum=sum+y; //bcz Sum is not defined , so u can use "sum" int Y=y+2; //u need to define Y first then provide it a value /* Y will be 9 , if above corrections were made , else output will be error */
23rd Aug 2017, 10:29 PM
Changed
Changed - avatar
+ 3
@Restoring Ahhh, I wonder if that's it or simply because they're typing with their phone (stupid auto caps)? If that's the twist, then I could see that. I just assumed it was poor typing because English is their second language or because many people are on cell phones so it automatically capitalizes first letter of each sentence, which appears to be the case since Int is also capitalized.
23rd Aug 2017, 5:31 PM
AgentSmith
0
Sum is not defined
23rd Aug 2017, 7:18 PM
S C