Question
I need to sort the following in alphabetical order using Java 2D array: Tones and I Roddy Ricch KAROL G Eminem Justin Bieber Future The
I need to sort the following in alphabetical order using Java 2D array:
Tones and I Roddy Ricch KAROL G Eminem Justin Bieber Future The Weeknd Arizona Zervas Trevor Daniel Dua Lipa Maroon 5 Post Malone Billie Eilish Mac Miller The Black Eyed Peas Halsey Lewis Capaldi Shawn Mendes BTS Selena Gomez Selena Gomez Eminem Billie Eilish Harry Styles Camila Cabello Eminem Jonas Brothers Dimelo Flow blackbear Eminem Bad Bunny Eminem DaBaby Regard Lewis Capaldi YNW Melly Don Toliver Mac Miller Harry Styles Rauw Alejandro Dalex MEDUZA Doja Cat Eminem Anuel AA BROCKHAMPTON Travis Scott Tyga Mac Miller Ed Sheeran Post Malone Eminem Juice WRLD Mustard Shakira J Balvin Eminem Lil Uzi Vert SAINt JHN Ed Sheeran Juice WRLD Mac Miller Nicky Jam Khalid Ed Sheeran Nicky Jam 000 Hours (with Justin Bieber) JP Saxe Mac Miller Eminem Mac Miller Eminem Eminem Eminem Y2K Juju The Weeknd J Balvin SHAED Halsey Jhay Cortez Roddy Ricch Black Thought Bad Bunny Tainy Travis Scott Ariana Grande Billie Eilish DaBaby Eminem Mac Miller Billie Eilish Sam Smith Eminem Post Malone Lady Gaga DaBaby Mac Miller J Balvin Eminem Daddy Yankee Eminem Ant Saunders Lil Nas X Stormzy Lil Tecca Ali Gatie Lauv Lunay Noah Cyrus Marshmello Halsey Eminem Dalex Halsey Pt. II Jonas Brothers Mac Miller Post Malone Rich Music LTD Harry Styles Lewis Capaldi Lil Baby Imagine Dragons Reik Lil Baby Juice WRLD Red Velvet Henrique & Juliano Arizona Zervas Drake Matthew Wilder Sech Post Malone Tones and I JACKBOYS blackbear Queen Mac Miller Surfaces Lizzo Ed Sheeran Camilo MEDUZA ROSALA Ellie Goulding Selena Gomez Mac Miller Harry Styles Rich Music LTD Lunay Travis Scott Sam Smith Ava Max Ufo361 XXXTENTACION Mac Miller Arcangel Kina Chris Brown James Arthur Lizzo Kina benny blanco BTS Kygo Gambi Maes Ariana Grande Maroon 5 Ed Sheeran Billie Eilish Billie Eilish DJ Snake Jonas Brothers Camila Cabello XXXTENTACION Young Thug Thiaguinho MT Riton DaBaby Piso 21 Conan Gray ROSALA Olivia Rodrigo Travis Scott YNW Melly Dominic Fike Post Malone Shawn Mendes Daddy Yankee Panic! At The Disco Dalex Sech J Balvin J. Cole Lauv XXXTENTACION Dean Lewis 5 Seconds of Summer
This data came from a csv file.
Here is my code:
import java.io.*;
import java.util.*;
public class sorting {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(new BufferedReader(new FileReader("csvFiles.csv")));
int rows = 200;
int cols = 5;
String [][] arr = new String[cols][rows];
while(sc.hasNextLine()){
for(int i=0; i < arr.length; i++ ){
String[] line = sc.nextLine().split(",");
for(int j=0; j < line.length; j++){
arr[i][j] = line[j];
}
System.out.println(arr[i][2]);
}
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started