Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package md.WK14toWK18;
- import java.util.Arrays;
- public class number05 {
- public static void main(String[] args) {
- int[] array = {5, 2, 7, 9, 6};
- System.out.println("Original array : " + Arrays.toString(array));
- for (int i = 0; i < array.length / 2; i++) {
- int temp = array[i];
- array[i] = array[array.length - i - 1];
- array[array.length - i - 1] = temp;
- }
- System.out.println("Reverse array : " + Arrays.toString(array));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement