Java program for pass by value or call by value on November 19, 2021 Get link Facebook X Pinterest Email Other Apps class Args2{ static void swap(int a, int b) { int t = a; a = b; b = t; } public static void main(String[] args) { int x = 5,y = 7; System.out.println("x = "+x+" y = "+y); swap(x,y); System.out.println("x = "+x+" y = "+y); }}OUTPUT Comments
Comments
Post a Comment