Please SUBSCRIBE! More programming videos coming soon! ✌️
@ralphmoreno29746 жыл бұрын
Great video!
@Appficial6 жыл бұрын
Thanks Ralph!
@xanderlammers48833 жыл бұрын
Thank you
@Everent3 жыл бұрын
Question, sir: Could you use these methods to sort a 2D string array so that the array elements are sorted from A to Z? I have seen some videos related to this, but not exactly what I need. I have a project concerning this and for some reason, there is one piece that is giving me a bit of trouble. This is some of the relevant code right here: for(int i=0; i>numberOfRows; i++) { if(statesCapitals[i].compareToIgnoreCase(statesCapitals[i-1]) > 0) { temp = statesCapitals[i]; statesCapitals[i] = statesCapitals[i-1]; statesCapitals[i - 1] = temp; } My compareToIgnoreCase is giving me an error: Cannot invoke compareToIgnoreCase(String[]) on the array type String[]. I'm not exactly sure what's wrong with the code since both elements are strings. Any help would be appreciated! Thanks!
@Appficial3 жыл бұрын
For a 2D array, you would loop through each element and sort it, since each element is also an array. Since you are working with Strings, you can just use the Comparator sort() method
@Everent3 жыл бұрын
@@Appficial Thank you for the help, sir!
@TheNationalStar Жыл бұрын
And if i want compare 3 strings: for example: "kali, karkiv, karola" ? How can i do it at the same time? and how put in order in a list?
@Appficial Жыл бұрын
Use && for compound expressions. Then use arrays or ArrayList to store them in a list. I have videos on both
@TheNationalStar Жыл бұрын
@@Appficial , oh thank you a lot. I will try to find this videos :)