Re: Arrays.sort(s) caused an error
- From: "jhr" <jh.richards@xxxxxxxxx>
- Date: 11 Jul 2006 10:13:29 -0700
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.
.
- References:
- Arrays.sort(s) caused an error
- From: niceguy16
- Arrays.sort(s) caused an error
- Prev by Date: Re: Exception handler problem.
- Next by Date: Re: Exception handler problem.
- Previous by thread: Re: Arrays.sort(s) caused an error
- Next by thread: Exception handler problem.
- Index(es):
Relevant Pages
|
|