This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 635

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: 13
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: 43935
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
Have you checked out Aspose?
subject: array sort
It's not a secret anymore!