{}
CODE VISUALIZER
Master DSA, Python and C with step-by-step code visualization.
See it in action
CODE VISUALIZER
Master DSA, Python and C with step-by-step code visualization.
See it in action
run-icon
Main.java
class ReverseArray { public static void main(String[] args) { int[] arr={12,13,5,67,8,9,5,4}; for(int ele: arr){ System.out.print(ele+" "); } int n=arr.length; int i=0,j=n-1; while(i<=j){ int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; i++; j--; } System.out.println("\nafter reverse="); for(int ele: arr){ System.out.print(ele+" "); } } }
Output