Topic: 数组排序问题 ? |
Print this page |
1.数组排序问题 ? | Copy to clipboard |
Posted by: heartache Posted on: 2006-03-22 20:40 我的代码 (用记事本编辑的): public class sort { public static void main(String[] args) { int[] a={12,8,47,51,91,82,100,84,72,19}; System.out.println(java.util.Arrays.sort(a[])); } } 运行报错, 请问是怎么回事 ? : { Please don't use BMP, 100KB BMP --> 3KB GIF --why } |
2.Re:数组排序问题 ? [Re: heartache] | Copy to clipboard |
Posted by: zcjl Posted on: 2006-03-23 00:47 import java.util.Arrays; 代码需要jakarta-commons-lang-2.0.jar |
3.Re:数组排序问题 ? 新问题来了! [Re: heartache] | Copy to clipboard |
Posted by: heartache Posted on: 2006-03-23 09:36 结果又有更多错误! { converted 422KB BMP to this 6KB GIF with the simple Paint program; unnecessary stuff at the bottom right had been removed. Actually, in this case, you should just cut-n-paste the contents from the Command Prompt window, instead of using an image -- why } |
4.Re:数组排序问题 ? [Re: heartache] | Copy to clipboard |
Posted by: heartache Posted on: 2006-03-23 09:40 jakarta-commons-lang-2.0.jar JDK里面好象没有看到这个东西呢 ? |
5.Re:数组排序问题 ? [Re: heartache] | Copy to clipboard |
Posted by: jackyangf Posted on: 2006-03-23 10:11 ........ sort 没有返回值, 你怎么print ? 用一个方法最少的看看说明吧? |
6.Re:数组排序问题 ? [Re: heartache] | Copy to clipboard |
Posted by: zcjl Posted on: 2006-03-23 11:13 heartache wrote: JDK里面本来就没有啊 不过你google一下就会找到了 或者去这里: http://www.apache.org/dist/jakarta/commons/lang/binaries/ |
7.Re:数组排序问题 ? [Re: zcjl] | Copy to clipboard |
Posted by: why Posted on: 2006-03-23 18:30 zcjl wrote:import java.util.Arrays; heartache: as you may noticed, ArrayUtils.toString(a) is used for printing the array. java.util.Arrays.sort(a[])) is wrong, should be java.util.Arrays.sort(a)), as in zcjl's code. |
8.Re:数组排序问题 ? [Re: heartache] | Copy to clipboard |
Posted by: phoenix451 Posted on: 2006-03-24 08:45 出错的原因是java.util.Arrays.sort(a)返回的是ivoid类型数据, 把程序改成如下就可以了: public class sort { public static void main(String[] args) { int[] a={12,8,47,51,91,82,100,84,72,19}; java.util.Arrays.sort(a); for(int i=0;i<a.length;i++) { System.out.println(a[i]); } } } check "Disable Smileys" |
9.Re:数组排序问题 ? [Re: heartache] | Copy to clipboard |
Posted by: phoenix451 Posted on: 2006-03-24 09:04 不知道怎么回事,()内部加a全部变成了一个脸, 出错的原因是java.util.Arrays.sort(a[])) , 它应该是java.util.Arrays.sort |
10.Re:数组排序问题 ? [Re: heartache] | Copy to clipboard |
Posted by: phoenix451 Posted on: 2006-03-24 09:05 Post is deleted |
11.Re:数组排序问题 ? [Re: phoenix451] | Copy to clipboard |
Posted by: zcjl Posted on: 2006-03-24 09:05 phoenix451 wrote: |
12.Re:数组排序问题 ? [Re: heartache] | Copy to clipboard |
Posted by: suntao19830709 Posted on: 2006-03-24 09:57 给你一个我写的快速排序的算法
|
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |