Here the output is comingpublic class GG{ public static void main(String[] args) { Integer i = new Integer(10); System.out.println("Before Call:"+i); change(i); System.out.println("After Call:"+i); } public static void change(Integer x){ x=20; } }
Before Call:10
After Call:10
I am confused when i am passing an object in a function then why the value is not changed as objects are passed by reference??