Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help anda what is the package for the sort()

 
Joshhhh Peter
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Is the sort() meth. inside the java.util.*; ??

Im trying to sort the numbers from the lowest to the highest

like:




System.out.print( Insert an int: );
int [ ] numbers = new int [4]

// Array.sort(numbers); <--- is that correct?




thanks!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15369
40
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> // Array.sort(numbers); <--- is that correct?

No, it should be Arrays.sort(numbers) (note, Arrays, not Array).
And class Arrays is indeed in package java.util.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic