9. (a) What is the output of the main method when thefollowing program is execut
ID: 3618934 • Letter: 9
Question
9. (a) What is the output of the main method when thefollowing program is executed?WHAT I WANT YOU TO DO IS TO GIVE ME A DETAILED EXPLANATION OFTHIS CODE, THE ANSWER IS GIVEN. MAKE IT NICE AND CLEAR PLEASE THANKS public class Prog08{ private static int i=1; public static int m1(int i){ i=3*i-1; return i-1; } public static void m2(int i){ i=i-2; int n=m1(i); System.out.println(i); } public static int m3(){ int i=4; i=2*i-3; System.out.println(i); return i+1; } public static void main(String[] args){ System.out.println(i); i = m3(); System.out.println(i); m2(i+1); int a=m1(i-1); System.out.println(a); } }
The answer is as follows: 1 5 6 5 13 9. (a) What is the output of the main method when thefollowing program is executed?
WHAT I WANT YOU TO DO IS TO GIVE ME A DETAILED EXPLANATION OFTHIS CODE, THE ANSWER IS GIVEN. MAKE IT NICE AND CLEAR PLEASE THANKS public class Prog08{ private static int i=1; public static int m1(int i){ i=3*i-1; return i-1; } public static void m2(int i){ i=i-2; int n=m1(i); System.out.println(i); } public static int m3(){ int i=4; i=2*i-3; System.out.println(i); return i+1; } public static void main(String[] args){ System.out.println(i); i = m3(); System.out.println(i); m2(i+1); int a=m1(i-1); System.out.println(a); } }
The answer is as follows: 1 5 6 5 13 1 5 6 5 13
Explanation / Answer
x.P5rong>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.