Question: Consider this program: public class Example { public static void foo ( int a ) { a = 9 9 ; } public static void

Consider this program:
public class Example { public static void foo(int a){ a =99; } public static void main(String[] args){ int a =100; foo(a); System.out.println(a); //100}}
Why doesn't foo() change the value of a?

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 Programming Questions!