Skip to content

Commit

Permalink
Merge pull request #138 from ChauhanDiya/master
Browse files Browse the repository at this point in the history
Hacktoberfest-2022
  • Loading branch information
Ayushsinhahaha authored Oct 31, 2022
2 parents ea2722b + e8463b6 commit 695f258
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.util.ArrayList;
import java.util.Collections;

class Main {
public static void main(String[] args) {

// Creating an array list
ArrayList<Integer> numbers = new ArrayList<>();

// Add elements
numbers.add(4);
numbers.add(2);
numbers.add(3);
System.out.println("Unsorted ArrayList: " + numbers);

// Using the sort() method
Collections.sort(numbers);
System.out.println("Sorted ArrayList: " + numbers);

}
}

0 comments on commit 695f258

Please sign in to comment.