当前位置:网站首页>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
边栏推荐
- 氫氧化鈉是什麼?
- [idea] common shortcut keys
- CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
- arcgis_ spatialjoin
- How to delete the virus of inserting USB flash disk copy of shortcut to
- Graduation thesis project local deployment practice
- Miracast技术详解(一):Wi-Fi Display
- Unforgettable summary of 2021
- DataGrid offline installation of database driver
- Line test -- data analysis -- FB -- teacher Gao Zhao
猜你喜欢

Matrix and TMB package version issues in R

Ugnx12.0 initialization crash, initialization error (-15)

611. Number of effective triangles

行测--资料分析--fb--高照老师

I implement queue with C I

And let's play dynamic proxy (extreme depth version)

Clickhouse database installation deployment and remote IP access

玩转gRPC—深入概念与原理

Tshydro tool

Self summary of college life - freshman
随机推荐
Package ‘*****‘ has no installation candidate
Apple system shortcut key usage
611. Number of effective triangles
Altimeter data knowledge point 2
SQL JOINS
Import CV2, prompt importerror: libcblas so. 3: cannot open shared object file: No such file or directory
Unforgettable summary of 2021
Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
Basic series of SHEL script (III) for while loop
Pagoda create multiple sites with one server
Let me teach you how to develop a graphic editor
Tshydro tool
Graduation thesis project local deployment practice
公安基础知识--fb
cygwin
II Simple NSIS installation package
[idea] efficient plug-in save actions to improve your work efficiency
HDU1232 畅通工程(并查集)
And let's play dynamic proxy (extreme depth version)
Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no