Skip to Main Content

can anyone explain from the 3rd line of the output of this java program.?

User_2HV0MSep 16 2022

class Wow{
public static void main(String[] args) {
int ab = 98;
System.out .println("ab in Main Before\t:" + ab);
Mno ref = new Mno();
ref.showValue(ab);
System.out .println("ab in Main After\t:" + ab);
}
}
class Mno {
void showValue(int ab) {
System.out .println("Before showValue\t:" + ab);
if (ab != 0)
showValue(ab / 10);
System.out .println("After showValue \t:" + ab);
}
}

output
ab in Main Before :98
Before showValue :98
Before showValue :9
Before showValue :0
After showValue :0
After showValue :9
After showValue :98
ab in Main After :98

This post has been answered by Ana Kalemi on Sep 20 2022
Jump to Answer
Comments
Post Details
Added on Sep 16 2022
1 comment
53 views