aspose file tools*
The moose likes Beginning Java and the fly likes array sort Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "array sort" Watch "array sort" New topic
Author

array sort

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635


This code thorws an exception in this line:Arrays.sort(array);

why?
Avishkar Nikale
Ranch Hand

Joined: Aug 06, 2010
Posts: 173
1) Are you sure this is the complete code?

2) Do you mean a compiler error as opposed to exception?


Regards,
Avishkar Nikale
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

What is the exception thrown ??


Regards, Rene Larsen
Dropbox Invite
Damilola Okuboyejo
Greenhorn

Joined: Aug 21, 2009
Posts: 13
abalfazl hossein wrote:

This code thorws an exception in this line:Arrays.sort(array);

why?

--------------------------------------------
the syntax looks ok, but for the main method
guess the exception ws NoSuchMethodFoundException

TRY

import java.util.Arrays;

public class Main {

public static void main(String[] argv)
{
int i;
int array[] = {12,9,4,99,120,1,3,10};
Arrays.sort(array);

for (i = 0; i < array.length; i++)
System.out.println(array[i]);
}

}
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38765
    
  23
Damilola Okuboyejo wrote: . . . guess the exception ws NoSuchMethodFoundException . . .
Why?

As previously suggested, that looks more like a compiler error because a line was omitted. Please supply full details and the real code, abalfazl hossein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: array sort