Question: What will be following program display? package javaapplication 4 0 5 ; public class JavaApplication 4 0 5 { public static void main ( String

What will be following program display? package javaapplication 405 ;
public class JavaApplication 405{
public static void main(String[] args){
int x=10;
}
System.out.println(myMethod(x));
public static int myMethod( int num){
if ( num 0)
return 0
else
return myMethod(num-1)+ num;
}
}
// output:
// Shows the recursive step, base step and the return values.
 What will be following program display? package javaapplication 405 ; public

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!