day14-三元运算符

public class Demo07 {
public static void main(String[] args) {
int a = 10;
int b = 20;

    a+=b; //a=a+b //a-=b;  a=a-b

    System.out.println(a);
    //字符串连接符   +,String 会把其他操作数也转成字符串类型再进行连接
    System.out.println(a+b);
    System.out.println(""+a+b);//String在前面,直接将后面进行拼接
    System.out.println(a+b+"");//String在后面,先进行计算,再进行拼接

}

}

三元运算符

public class Demo08 {
public static void main(String[] args) {
//x ? y : z
//如果x==true,则结果位y,否则结果为z

    int score = 58;
    String type = score <60 ?"不及格":"及格";//必须掌握
    System.out.println(type);
}

}

导入包

import …… .*导入所有文档

JavaDoc 生成文档

参数信息:
@author 作者名
@version 版本号
@since 指明需要最早使用的jdk版本
@param 参数名
@throws 异常抛出情况

命令行生成文档解决乱码的问题 javadoc -encoding UTF-8 -charset UTF-8 Doc.java

posted @ 2021-06-30 22:00  shum  阅读(49)  评论(0)    收藏  举报