+ 1

Can anyone tell me were to find the information for question 2 of the primative operations. Core concepts, java tutorial.

4th Aug 2019, 10:17 PM
Colin White
4 Antworten
+ 3
Comment to each quiz is at lower left, not upper right. https://www.sololearn.com/post/131750/?ref=app
5th Aug 2019, 12:03 AM
Gordon
Gordon - avatar
+ 1
Well the question is looking for the sum of two variables in which it wants that sum to be displayed to the screen. We know that: int x = 2; int y = 4; So, how do we get the sum of those two numbers? well we add them. As dicussed in the lesson prior to that question, we can use the “+” operator to add two values together. Since we know x contains the value 2 and y contains the value 4, then x+y would be the same as saying 2+4 in which either would result in the sum of 6. (However we favor the former, because why create two variables if we arent going to use them?) Now, in order to display the sum of our addition, we would need to output it to the console (the sum of which is being stored in the variable named result) we learned in the “hello world” lesson that we can display something to the screen by using System.out.println(argument) and the value(or variable) we put within those two parantheses in place of “argument” is what will be displayed to the screen such as if you were to replace argument with “hello world”, then when the program is ran, “hello world” would be displayed on the screen. So if we wanted to display the result of our addition, what would we put between those two parantheses in place of argument?
4th Aug 2019, 11:45 PM
Jake
Jake - avatar
0
Did you try checking the comments on the question?
4th Aug 2019, 10:51 PM
Jake
Jake - avatar
0
I cannot find comments for the question, only the information sections.
4th Aug 2019, 11:15 PM
Colin White