Question: java coding help please. need info on outputs/return of the methods and if possible work done to find so. 1. public void method1(int n) {

java coding help please. need info on outputs/return of the methods and if possible work done to find so.

1. public void method1(int n) { if(n>=0) { System.out.println(n); method1(n-1); } }

2. public void method2(int n) { if(n>=0) { method2(n-2); System.out.print(n); } }

3. public void method3(int n) { if(n>=0) { System.out.print(n); method3(n-2); System.out.println(n); } }

4. public int method4(int n) { if(n>2) return 3 + method4(n/2); else return 5; }

5. public static void stars(String s) { if(s.length()<8) { stars(s+s); System.out.println(s); } }

x.method1(8);

x.method2(8);

x.method3(8);

System.out.println(x.method4(30));

x.stars("*");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!