两个数按从大到小顺序输出
public class DayOne {
public static void main(String[] args) {
int a=5;
int b=11;
System.out.println("a:"+a+'\n'+"b:"+b);
a=a^b;
b=a^b;//(a^b)^b==a
a=a^b;//(a^b)^a==b
System.out.println("a:"+a+'\n'+"b:"+b);
}
}
两个数输出及较大的那个
public class DayOne {
public static void main(String[] args) {
int a=35;
int b=35;
int max=(a>b)?a:b;
String str=(a>b)?"a大":(a==b)?"相等":"b大";
System.out.println(max);
System.out.println(str);
}
}