Answer to Question #59354 in Java | JSP | JSF for Tshidi

Question #59354
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);
1
Expert's answer
2016-04-20T11:26:04-0400
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS