Computer Science, asked by dograbrothers3179, 9 months ago

What is String array? Write a program to input 6 district of odisha and display in an ascending order.

Answers

Answered by akshayamca14
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