swap function java
public static void swap(int[] a, int i, int j){
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
swap function java
public static void swap(int[] a, int i, int j){
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
swapping with two variables in java
public class Exercise15 {
public static void main(String[] args) {
// int, double, float
int a, b;
a = 15;
b = 27;
System.out.println("Before swapping : a, b = "+a+", "+ + b);
a = a + b;
b = a - b;
a = a - b;
System.out.println("After swapping : a, b = "+a+", "+ + b);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us