Re: Arrays.sort(s) caused an error




niceguy16 wrote:
Hi,

I have this code:

String[] s= {"Mark","Steve","Pete"};
s=Arrays.sort(s);

The 2nd line has an error saying:
incompatible types
found : void
required: java.lang.String[]
s=Arrays.sort(s);
^
1 error

Why?

Thanks.

sort doesn't have a return value. Arrays are muttable, this allows the
array you pass in as a param to be sorted after the method call.

.



Relevant Pages

  • Re: Recognize directories and files.
    ... What is annoying, is that the arrays are empty at program load, ... and Perl returns an error saying it cannot sort empty void. ...
    (comp.lang.perl.misc)
  • Re: SQLBulkOperations question
    ... The arrays are not of the same length. ... T> gives an error saying that duplicate values are being written though ... T> If the table does not have a primary key things go ok. ... T> BulkOps without the totla data being a multiple of the first array? ...
    (microsoft.public.data.odbc)
  • Error due to large array?
    ... when i try to execute the following program i get an error saying: ... the system can not execute the specified program. ... smaller (all arrays less than about 5000), ...
    (comp.lang.fortran)
  • Error installing activesync
    ... sort the directory by size. ... MSK ... >I am installing activesync on a MS2000 workstation. ... I get an error saying ...
    (microsoft.public.pocketpc.activesync)
  • Re: Arrays.sort(s) caused an error
    ... Steve W. Jackson wrote: ... The 2nd line has an error saying: ... found: void ...
    (comp.lang.java.gui)