当前位置:网站首页>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
边栏推荐
- P3D gauge size problem
- Opendrive record
- Pagoda create multiple sites with one server
- [idea] efficient plug-in save actions to improve your work efficiency
- Opendrive ramp
- Typescript get timestamp
- Unconventional ending disconnected from the target VM, address: '127.0.0.1:62635', transport: 'socket‘
- CADD课程学习(5)-- 构建靶点已知的化合结构(ChemDraw)
- Web page Chinese display (print, etc.) GBK error, solution, software
- 苏打粉是什么?
猜你喜欢
SQL JOINS
And let's play dynamic proxy (extreme depth version)
Logistic regression: the most basic neural network
P3D gauge size problem
Latex notes
[idea] efficient plug-in save actions to improve your work efficiency
Unforgettable summary of 2021
2022 PMP project management examination agile knowledge points (7)
Idea common settings
How to modify the file path of Jupiter notebook under miniconda
随机推荐
苏打粉是什么?
Basic knowledge of public security -- FB
Today, share the wonderful and beautiful theme of idea + website address
Mouse click fireworks explosion effect
Logistic regression: the most basic neural network
Typescript get timestamp
Qu'est - ce que l'hydroxyde de sodium?
Opendrive record
借助 Navicat for MySQL 软件 把 不同或者相同数据库链接中的某数据库表数据 复制到 另一个数据库表中
Deepin, help ('command ') output saved to file
arcgis_ spatialjoin
Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no
Idea push project to code cloud
Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
[MySQL] database knowledge record
Microservice registry Nacos introduction
cygwin
Idea shortcut key
UE5热更新-远端服务器自动下载和版本检测(SimpleHotUpdate)
Tshydro tool