Description
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("================================================");
}
Explanation & Answer
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.Review
Review
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
The Elegant Universe
by Brian Greene
Black Beauty
by Anna Sewell
Heart of Darkness
by Joseph Conrad
The Trial
by Franz Kafka
One Flew Over the Cuckoos Nest
by Ken Kesey
The Calcutta Chromosome
by Amitav Ghosh
How to Win Friends and Influence People
by Dale Carnegie
The Fault in Our Stars
by John Green
100 Side Hustles
by Chris Guillebeau