Sorting a text file in Java

前端 未结 3 1724
星月不相逢
星月不相逢 2021-01-07 00:25

I have a text file with a list of words which I need to sort in alphabetical order using Java. The words are located on seperate lines.

How would I go about this, R

3条回答
  •  旧巷少年郎
    2021-01-07 00:50

    This is a simple four step process, with three of the four steps addressed by Stackoverflow Questions:

    1. Read each line and turn them into Java String
    2. Store each Java String in a Array (don't think you need a reference for this one.)
    3. Sort your Array
    4. Write out each Java String in your array

提交回复
热议问题