JAVA 冒泡基础版

public class Sort4 {
    public static void main(String[] args) {
        int x = 9;
        int y = 2;
        int z = 1;
        
        int temp = 0;
        
        if(x > y) {
            temp = x;
            x = y;
            y = temp;
        }
        
        if(x > z) {
            temp = x;
            x = z;
            z = temp;
        }
        
        if(y > z) {
            temp = y;
            y = z;
            z = temp;
        }
    
        System.out.println(x+"=="+y+"=="+z);
    }
}

 

posted @ 2018-04-26 20:12  马鞍山  阅读(108)  评论(0编辑  收藏  举报