Code:
// ap7,運算式真假值 public class ap7 { public static void main(String args[]) { int a=126; int b=-2*a; boolean c=true; boolean d=!c; //false System.out.println("a=" + a); System.out.println("b=-2*a=" + b); System.out.println("c=" + c); System.out.println("d=!c=" + d); System.out.print("((a>b)?c:d)="+((a>b)?c:d)+"\n"); //true System.out.print("((ab)?d:c)+"\n"); //false } }
Output:
a=126 b=-2*a=-252 c=true d=!c=false ((a>b)?c:d)=true ((a<b)?c:d)=false Press any key to continue...
Discuss:
0 comments:
Post a Comment