Top 50 Java Programming Interview Questions
public static void main(String[] args) {
int x,y;
System.out.println("Please Enter x and y");
Scanner in=new Scanner(System.in);
x=in.nextInt();
y=in.nextInt();
System.out.println("Before Swap \nx = "+x+"\ny = "+y);
x=x+y;
y=x-y;
x=x-y;
System.out.println("After Swap \nx = "+x+"\ny = "+y);
}
On this page of the site you can watch the video online How do you swap two numbers without using a third variable in Java? with a duration of hours minute second in good quality, which was uploaded by the user The Disciplined learner 08 August 2023, share the link with friends and acquaintances, this video has already been watched 138 times on youtube and it was liked by 5 viewers. Enjoy your viewing!