小编Emm*_*ual的帖子

从Java中的单个方法返回两个不同的对象

嗨,我试图返回两个数组,1作为字符串,另一个作为浮点数; 返回我在网上搜索它是令人困惑的,我是新来的oops

public String[][]  loadcost(String[][] arr2, int tcount) {

        int f1 = 1;
        int f2 = 0;
        int[] costarr = null ;


        while (f2 < tcount){

            arr2[f1][f2] = cost.nextLine();
            costarr[f2] = Integer.parseInt (arr2[f1][f2]);
            f2 = f2 + 1;                            
        }

        Arrays.sort(costarr);
        return arr2 , costarr ;
Run Code Online (Sandbox Code Playgroud)

我最初的要求是对二维数组进行排序,它使用我在网上得到的代码

BBB 444 DDD 098 FF 19.01

想用第二列排序

java

1
推荐指数
1
解决办法
902
查看次数

标签 统计

java ×1