Forums Register Login

array sort

+Pie Number of slices to send: Send


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

why?
+Pie Number of slices to send: Send
1) Are you sure this is the complete code?

2) Do you mean a compiler error as opposed to exception?
+Pie Number of slices to send: Send
What is the exception thrown ??
+Pie Number of slices to send: Send
 

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

}
+Pie Number of slices to send: Send
 

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
What's wrong? Where are you going? Stop! Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1104 times.
Similar Threads
Trying to print first 100 prime numbers using an array
question related to ragged array
Array dimension missing
Widening Reference Conversation
doubt pg 340 of k&b
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:55:57.