What is String array? Write a program to input 6 district of odisha and display in an ascending order.
Answers
Answered by
0
Answer:
import java.util.Scanner;
import java.util.*;
public class Main
{
public static void main (String[]args)
{
int a[] = new int[50];
Scanner in = new Scanner (System.in);
String districts[] = new String[6];
for (int i = 0; i < districts.length; i++)
{
System.out.println ("Enter district from Odisha");
String district = in.next ();
districts[i] = district;
}
Arrays.sort(districts);
System.out.printf("Ascending order districts:\n");
for (int i=0; i<districts.length; i++) {
System.out.println(districts[i]);
}
}
}
Explanation:
Similar questions
Math,
5 months ago
Science,
5 months ago
Computer Science,
5 months ago
Environmental Sciences,
9 months ago
Physics,
1 year ago
Physics,
1 year ago