class Demo01 { public static void main(String[] args) { //int j=4; //短路与的时候,当左边为false的时候,右边就不会再判断 //System.out.println(5>4&&j++>3); //System.out.println(j); //短路或的时候,当左边为true的时候,右边就不会再判断 //System.out.println(5>4 || j++>3); //System.out.println(j); //三元运算符 int a = 2; int b = 5; System.out.println(a>b?1:2); } }
class Test01 { public static void main(String[] args) { /*int a1 = 100; double a2 = 2.4; float b = 2.4f; char ch = '中'; char ch2 = '国'; System.out.println(a1+"..."+a2+"..."+b); System.out.print(ch+"..."+ch2); double i= 2.4; int a = (int)i; System.out.print(a);*/ System.out.println("---------------------------"+"商城库存清单"+"-------------------------------"); System.out.println("品牌型号"+" "+"尺寸"+" "+"价格"+" "+"库存数"); String Product_name1 = "MacBookAir"; String Product_name2 = "ThinkpadT450"; String Product_name3 = "ASUS-FL5800"; double size1 = 13.3; double size2 = 14.0; double size3 = 15.6; double price1 = 6988.88; double price2 = 5999.99; double price3 = 4999.5; int num1 = 5; int num2 = 10; int num3 = 18; System.out.println(Product_name1+" "+size1+" "+price1+" "+num1); System.out.println(Product_name2+" "+size2+" "+price2+" "+num2); System.out.println(Product_name3+" "+size3+" "+price3+" "+num3); System.out.println("------------------------------------------------------------------------"); int anum = num1 + num2 + num3; double aprice = price1 + price2 + price3; System.out.println("总库存数:"+anum); System.out.println("库存商品总金额:"+aprice); } }