image
image

package Bao2;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType;

public class Day3 {
    public static void main(String[] args) {
        // +=  -=
        int a = 10;
        int b = 20;
        a+= b; //  a = a+b
        System.out.println(a);
        a-= b;  // a = a-b
        System.out.println(a);

        System.out.println("===============");
        //字符串连结符   +  string
        System.out.println(""+a+b);
        System.out.println(a+b+"");   //字符串在前面,不运算,直接连结起来;在后面,直接运算前面

        System.out.println("===============");
        // 三元运算    x ? y : z
        //  如果x==true  则结果为z
        int score = 80;
        String type = score < 60  ? "不及格" : "及格";     // 必须掌握
        //if
        System.out.println(type);

    }
}

image

posted on 2021-09-06 09:26  亮闪闪的鱼  阅读(57)  评论(0)    收藏  举报