Multiple Choice: In the following code, how does the value of x or y change after exeCuting public static void main(String[]argsX int x = 50; int y = 25; sum(x,y);

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
QUESTION 18
Multiple Choice: In the following code, how does the value of x or y change after executing the method call sum(x,y)?
public static void main(String[]args){
int x = 50;
int y = 25;
sum(x,y);
public static int sum(int a, int b){
a = a + b;
return a;
x and y are both assigned to 75 after executing sum(x,y).
x is assigned to 75 after executing sum(x,y).
O y is assigned to 75 after executing sum(x,y).
Ox and y do not change.
QUESTION 19
Transcribed Image Text:QUESTION 18 Multiple Choice: In the following code, how does the value of x or y change after executing the method call sum(x,y)? public static void main(String[]args){ int x = 50; int y = 25; sum(x,y); public static int sum(int a, int b){ a = a + b; return a; x and y are both assigned to 75 after executing sum(x,y). x is assigned to 75 after executing sum(x,y). O y is assigned to 75 after executing sum(x,y). Ox and y do not change. QUESTION 19
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT