- 1

Need help with int sum

X+y

2nd Nov 2017, 3:00 PM
Jason Thompson
Jason Thompson - avatar
8 Réponses
+ 4
Can you provide more information as to what exactly you're looking for? a little detail wouldn't hurt :)
2nd Nov 2017, 3:02 PM
Ipang
+ 2
int is short for integer (whole number) int x=2; <-this creates a variable named x, and give a value of 2 into it, so now whenever someone refer to x you think of number 2. int y=4; <- same story, only this time we create and name the variable y, and we give it a value of 4. int result=x; <- this time we create another variable named result, but this time we set it to refer/point to variable x, which we created earlier, so when you use the result variable you're pretty much as if using x because they have same reference. Imagine a locker cabinet, which is your device memory, each slot in the cabinet can be used to store something, you need to have a card with the slot number to be allowed to see, claim, or use what's in the slot, in code, that card is reference. It's not unique, more than one person can have a card that refers to a certain slot. Each person having the same card sees, claims and uses the same thing that's in the slot, in your code "int result=x;" is saying that both result and x shares the same reference, hence, also the value, result and x are the cards that identifies which slot they have access to, wherein a value of 4 is stored. Hth, cmiiw
3rd Nov 2017, 1:43 PM
Ipang
+ 2
What do you mean " Trying to get system.out.print"? a little note, Java is case sensitive, if you mistyped a command for lower or upper case you will get errors, make sure the word case is correct :)
3rd Nov 2017, 1:47 PM
Ipang
0
int x=2 inty=4 int result=x ?
3rd Nov 2017, 11:59 AM
Jason Thompson
Jason Thompson - avatar
0
Am stuck here
3rd Nov 2017, 12:00 PM
Jason Thompson
Jason Thompson - avatar
0
Trying to figure it out
3rd Nov 2017, 12:00 PM
Jason Thompson
Jason Thompson - avatar
0
Trying to get system.out.print
3rd Nov 2017, 12:04 PM
Jason Thompson
Jason Thompson - avatar
0
Thanks it getting understood as I go alone the new journey into coding
3rd Nov 2017, 4:31 PM
Jason Thompson
Jason Thompson - avatar