Create a Java program to demonstrate a method with varargs that sorts a sequence of integers
import java.util.Arrays; public class SortNumbers { static void sortNumbers(int... numbers) { System.out.println("Given Numbers : " + Arrays.toString(numbers)); Arrays.sort(numbers); System.out.println("Sorted Numbers : " + Arrays.toString(numbers)); } public static void main(String[] args) { sortNumbers(80, 73, 65, 15, 39, 51); } }
Given Numbers : [80, 73, 65, 15, 39, 51] Sorted Numbers : [15, 39, 51, 65, 73, 80]
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions