0

(SOLVED)I am stuck with this code (java tutorial)

Hey guys can somebody help me solve this code? i searched back on the info but i cant find any info about this one, here is the problem. Fill in the blanks to print the sum of the two variables. int x = 2; int y = 4; int result = x _ _; System.out.printIn(__); what do i need to place between the()

13th Aug 2020, 9:31 PM
Julian
2 Réponses
+ 5
Hello Julian Variables stores the values and you can work with them like you would do in math. The value of x is 2 and the value of y is 4. To get the sum you just need to do the math: x + y To store the sum you assign the value to the variable result: int result = x + y //6 Now you just need to print the value of result: System.out.println(result); //output: 6
13th Aug 2020, 9:46 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
x+y result
13th Aug 2020, 9:34 PM
Abhay
Abhay - avatar