Write a Java program to sort a numeric array and a string array
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int [] ints = {4,1,3,0,9,2,5};
String[] strings = {"program","Code", "java", "Compile", "Run", "and", "Debug"};
Arrays.sort(ints);
Arrays.sort(strings);
System.out.println(Arrays.toString(ints));
System.out.println(Arrays.toString(strings));
}
}
Comments
Leave a comment