Java学习中的错误求大家帮我看看

package com.ssdou;

public class DateSort {
    public static void main(String[] args){
        int a[] = {3,2,8,6,7};
        int temp = 0;
        bubbleSort(a);
    
        for(int i = 0;i<a.length;i++){
            System.out.println(a[i]);
        }
        
        public static int[] bubbleSort(int[] a){
            for(int i = a.length-1;i>=1;i--){
                for(int j = 0;j<i;j++){
                    if(a[j+1]<a[j]){
                        temp = a[j+1];
                        a[j+1] = a[j];
                        a[j] = temp;
                    }
                }
            }
            return a;
        }
        
    }
}

http://img.mukewang.com/57eb83540001855a05640530.jpg

另种方式
浏览 1057回答 2
2回答

Caballarii

bubbleSort这个方法得写在main方法外面

另种方式

我也是刚看到
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java