2019.08.20上课笔记1

1.空格 :System.out.println("a b c");
System.out.println(a+" "+b+" "+c);

2.平均数 :double avg = (a + b + c)/3

连接符:

"hello"+55 --- > "hello55"
“hello”+5+55---》“hello555

System.out.println("hello"+(55+5));//hello60

55+5+“hello”》》》60hello

关系表达式 :boolean:布尔类型判断是否正确  <>,!=非等,逻辑运算符都属于布尔

 复合赋值运算符 :左边和右边做加法然后将右边的值加给左边a=5,b=2,a+=b,a=7,b=2其他算法同理

取余;   System.out.println(9876 % 10);// 6

逻辑运算符  :(a  and b )  or    y

int  year = 1994

boolean  result  = (year %4==0   year%100!=0)||year5%400==0

输出 result

&&=and =&   ||=或

&&  和||    运算符又叫短路运算符,如果第一个表达式的值,就能决定整个表达式的结果,那么运算符右边的表达式就不再计算。

| 和&无论第一个表达式结果是否决定整个表达式的结果都继续运算,运算符右边的表达式

if   :int  max = x>y?x:y;

sysout  ( max);

int     z  =   30  ;

int  max01  =max>z? max : z     

 分解并获得数字

int gewei = custNo % 10; 
int shiwei = custNo / 10 % 10; 
int baiwei = custNo / 100 % 10; 
int qianwei = custNo / 1000;

 System.out.println(9876 % 10);// 6

原文地址:https://www.cnblogs.com/fxlcd/p/11384105.html