zoukankan      html  css  js  c++  java
  • java中运算符的理解-0509

    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);
        }
    }
  • 相关阅读:
    SQL Server 文件操作
    约束5:外键约束
    SSIS 对数据排序
    列属性:RowGUIDCol、Identity 和 not for replication
    TSQL 数据类型转换
    HierarchyID 数据类型用法
    租房那些事
    SSIS 延迟验证
    SQL Server 管理全文索引
    SQL Server 全文搜索
  • 原文地址:https://www.cnblogs.com/yelena-niu/p/9034960.html
Copyright © 2011-2022 走看看