Created
April 28, 2021 11:39
-
-
Save syedjafer/abcdca95c478b3b38ccc288af16b4a31 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| /*function reverses the elements of the array*/ | |
| static void reverse(Integer myArray[]) | |
| { | |
| Collections.reverse(Arrays.asList(myArray)); | |
| System.out.println("Reversed Array:" + Arrays.asList(myArray)); | |
| } | |
| public static void main(String[] args) | |
| { | |
| Integer [] myArray = {1,3,5,7,9}; | |
| System.out.println("Original Array:" + Arrays.asList(myArray)); | |
| reverse(myArray); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment