aspose file tools*
The moose likes Beginning Java and the fly likes help anda what is the package  for the sort() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help anda what is the package  for the sort() " Watch "help anda what is the package  for the sort() " New topic
Author

help anda what is the package for the sort()

Joshhhh Peter
Greenhorn

Joined: Oct 13, 2005
Posts: 1
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

Joined: Aug 16, 2005
Posts: 13884
    
  10

> // 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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help anda what is the package for the sort()
 
Similar Threads
Searching an array - output problems - Please help!!
java.lang.ArrayIndexOutOfBoundsException - null
Output of array only on one line - any ideas why?
am i missing something?
generating numbers from 1 to 100 to store in an array