#Scanner and sorting array alphabetically

4 messages · Page 1 of 1 (latest)

limber summitBOT
#

This post has been reserved for your question.

Hey @wild comet! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

arctic birch
#

Looks like you aren't accounting for multiple blocks of input in your code. Write it something like this:

Scanner s = new Scanner(System.in);
while(s.hasNextLine()) {
  int n = Integer.parseInt(s.nextLine());
  String arr[] = new String[n];
  // read in
  // sort
}```
wild comet