怎么不会将我数组进行冒泡排序后将结果打印出来,请大家帮教我怎么改才能将排序后的结果打印出来

[复制链接]
查看11 | 回复3 | 2012-6-2 23:45:54 | 显示全部楼层 |阅读模式
public class TestM {public static void main(String[] args) {int num[] ={9 , 4 ,5 ,1 ,3 ,6 ,8, 7};print(num);m(num);
print(num);//这里调用多一次打印啊}private static void m(int a[]){int n = a.length;for(int i = n-1; i >= 1;i--) {for(int j = 0; j <=i-1;j++) {i...
回复

使用道具 举报

千问 | 2012-6-2 23:45:54 | 显示全部楼层
public class TestM {public static void main(String[] args) {int num[] ={9 , 4 ,5 ,1 ,3 ,6 ,8, 7};m(num);print(num);//你在打印的时候还没有调用函数啦//m(num); }private static ...
回复

使用道具 举报

千问 | 2012-6-2 23:45:54 | 显示全部楼层
在主方法中m过程后面再加一个print过程即可啦。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行