Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What will the following program display? public class checkpoint { public static

ID: 3843124 • Letter: W

Question


What will the following program display? public class checkpoint { public static void main(String urgs[]) { int n = 1776; doubled = 110.0901; System .out.println(n + + d); myMethod(n, d); System.out.println(n + + d); } public static void myMethod(int i, double x) { System.out.printing + + x); i = 1250; x= 199.99; System.out.println(i + " + x); } } Write the following two methods: i. compute Diameter; This method accepts the radius (r) of a circle, and returns diameter (2*r; radius = 2.5). Declare all variables used here & initialize radius: __________ Show method call: ________ Write method code here:

Explanation / Answer

Q-12
Answer :

1776   110.0901
1776   110.0901
1250 199.99
1776   110.0901

in Java Primitive variable are copied by value. so when you pass the variable n and d to mymethod new copy of n and d is created and assigned to x and i .

So, 4th line output is 1776 110.0901

Q - 13

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote