当前位置:网站首页>Day08 ternary operator extension operator character connector symbol priority
Day08 ternary operator extension operator character connector symbol priority
2022-07-05 07:36:00 【33 year old Java enthusiast】
Ternary operator ( Conditional operator )
x ? y : z ( Because there are three factors , Commonly known as ternary )
If x ==turn , The result is y, Otherwise z
Conditions ?turn Output :false Output ( amount to if sentence )
package operator;
public class demo06Day07 {
public static void main(String[] args) {
int a = 59;
//boolean b=true;
String c= a>60?" pass ":" fail, "; // If a Greater than 60, Then output the first value , Otherwise, output the second value .
System.out.println(c);
}
}
Extended assignment operators
- +=
- -+
- *=
- /=
package operator;
public class demo05Day07 {
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);
//a*=b;// a= a*b
//System.out.println(a);
//a/=b;// a= a/b
//System.out.println(a);
}
}
String connector
package operator;
public class demo07Day07 {
public static void main(String[] args) {
int a=10;
int b = 20;
System.out.println(" The output is :"+a+b);// First recognize the string , Connect according to string rules
System.out.println(" The output is :"+(a+b));// Recognize parentheses , The parentheses are finished , Then connect in sequence
System.out.println(a+b+" The output is :");// After the operation, it is connected with the string
/* If the string is recognized first in order , Just connect by string without operation */
}
}
Symbol priority , Be careful
- If you identify the string first , Is to string all the strings
- If the operation is recognized first , Just calculate first and then string .
summary : It depends on which priority , I'll do that .
priority :
- () Parentheses operate first
- /
- According to the order
边栏推荐
- Basic series of SHEL script (III) for while loop
- What if the DataGrid cannot see the table after connecting to the database
- Simple operation with independent keys (hey, a little fancy) (keil5)
- (tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements
- 【idea】Could not autowire. No beans of xxx type found
- Self summary of college life - freshman
- Web page Chinese display (print, etc.) GBK error, solution, software
- Detour of Tkinter picture scaling
- NPM and package common commands
- Logistic regression: the most basic neural network
猜你喜欢
Hdu1232 unimpeded project (and collection)
数字孪生实际应用案例-风机篇
HDU1231 最大连续子序列(分治or动规or双指针)
Miracast技术详解(一):Wi-Fi Display
并查集理论讲解和代码实现
Opendrive ramp
Target detection series - detailed explanation of the principle of fast r-cnn
Logistic regression: the most basic neural network
Openxlsx field reading problem
行测--资料分析--fb--高照老师
随机推荐
static的作用
How to deal with excessive memory occupation of idea and Google browser
Unforgettable summary of 2021
Batch convert txt to excel format
Professional knowledge of public security -- teacher bilitong
Esmini longspeedaction modification
CADD课程学习(5)-- 构建靶点已知的化合结构(ChemDraw)
Web page Chinese display (print, etc.) GBK error, solution, software
Chapter 2: try to implement a simple bean container
UE5热更新-远端服务器自动下载和版本检测(SimpleHotUpdate)
Apple system optimization
Cygwin installation
并查集理论讲解和代码实现
Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required
Latex notes
使用go语言读取txt文件写入excel中
Word import literature -mendeley
Machine learning Seaborn visualization
苏打粉是什么?
Hdu1231 maximum continuous subsequence (divide and conquer or dynamic gauge or double pointer)