标签:sort bsp str class int sys ring main example
输入3个数a,b,c,按大小顺序输出。
public class Example34 {
public static void main(String[] args) {
sort(5, 20, 15);
}
public static void sort(int a, int b, int c) {
if (a < b) {
int t = a;
a = b;
b = t;
}
if (a < c) {
int t = a;
a = c;
c = t;
}
if (b < c) {
int t = b;
b = c;
c = t;
}
System.out.print("从大到小的顺序输出:"+a + " " + b + " " + c);
}
}
标签:sort bsp str class int sys ring main example
原文地址:http://www.cnblogs.com/qubo520/p/6955804.html