The user enters the following code. What will be the value of
total after the code is executed?
val1 = 4;
val3 = 20;
total = sum(val1,val3);
package com.company;
public class Main {
static int sum(int a, int b) {
int total;
total = a + b;
return total;
}
public static void main(String[] args) {
int val1 = 4;
int val3 = 20;
int total = sum(val1,val3);
System.out.println("Total = " + total);
}
}
Total = 24
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF