Need help with Java for sorting by alphabetic order.

label Programming
account_circle Unassigned
schedule 1 Day
account_balance_wallet $5

Collections.sort(name); did not work.

import java.util.ArrayList;

import java.util.Scanner;

import java.io.*;

public class Main {

 static ArrayList<String> name = new ArrayList<String>();

-

-

-

-

 public static void SortByName(){

    System.out.println("================================================");

    for ( int i = 0 ; i < name.size(); ++ i ){

      System.out.println("name: "+ name.get(i));}

      System.out.println("================================================");    

  } 

Nov 30th, 2015

Thank you for the opportunity to help you with your question!

The class was not closed  and the incremental value may have issues 

public static void SortByName(){

    System.out.println("================================================");

    for ( int i = 0 ; i < name.size(); i++){

      System.out.println("name: "+ name.get(i));}

      System.out.println("================================================");    

  } 

}

You close the class and you change the incremental sign

Please let me know if you need any clarification. I'm always happy to answer your questions.
Nov 30th, 2015

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
...
Nov 30th, 2015
...
Nov 30th, 2015
Jun 26th, 2017
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer