File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

array sort

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 606

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

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?

Avishkar Nikale
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

What is the exception thrown ??

Regards, Rene Larsen
Dropbox Invite
Damilola Okuboyejo

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

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


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


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};

for (i = 0; i < array.length; i++)

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36508
Damilola Okuboyejo wrote: . . . guess the exception ws NoSuchMethodFoundException . . .

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:
subject: array sort
Similar Threads
Widening Reference Conversation
doubt pg 340 of k&b
question related to ragged array
Trying to print first 100 prime numbers using an array
Array dimension missing