public class lab14 { int a,b; public static void change(lab14 obj) { obj.a=20; obj.b=10; } public static void main(String[] args) { lab14 obj =new lab14(); obj.a=10; obj.b=20; System.out.println("values before changing are a="+obj.a+"b="+obj.b); change(obj); System.out.println("values after changing are a="+obj.a+"b="+obj.b); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter