title: java sort names with respect to location in descending order
body: <p>program to get  name and location value from user</p>
  
  <p>store in string array </p>
  
  <p>display name value based on location in descending order</p>
  
  <pre><code>public class Samp
  {
    public static void main(String[] args)
    {
      Scanner sc=new Scanner(System.in);
      String name[]=new String[5];
      System.out.println("enter the name");
      for(int i=0;i&lt;name.length;i++)
      {
        name[i]=sc.nextLine();
      }
  
      String location[]=new String[5];
      System.out.println("enter the  location");
      for(int i=0;i&lt;location.length;i++)
      {
        location[i]=sc.nextLine();
      }
      //want to sort name with respect to location in descending order
  
      System.out.println("Name and location:");
      System.out.println(name[0]+" "+location[0]);
      System.out.println(name[1]+" "+location[1]);
      System.out.println(name[2]+" "+location[2]);
      System.out.println(name[3]+" "+location[3]);
      System.out.println(name[4]+" "+location[4]);
    }
  }
  </code></pre>