+ 1
how do you printin the sum of variables
4 Respuestas
+ 4
use print function and add them either inside the function or out.
System.out.println (a+b);
+ 2
System.out.println(x+y);
where x and y are your variables
+ 1
Make sure that the two variables you want to add are Integers.
if not use: Integer.parseInt(strVar)
If both variables are Integers then do
System.out.println(a+b)
0
int x = 5;
int y = 10;
System.out.println(x + y);
/*or*/
int x,y,z;
x = 5;
y=4;
z=6;
System.put.println(x + y + z);