当前位置:网站首页>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
边栏推荐
- [MySQL] database knowledge record
- What is deep learning?
- [idea] efficient plug-in save actions to improve your work efficiency
- HDU1231 最大连续子序列(分治or动规or双指针)
- The golang timer uses the stepped pit: the timer is executed once a day
- With the help of Navicat for MySQL software, the data of a database table in different or the same database link is copied to another database table
- Play with grpc - go deep into concepts and principles
- Apple script
- repo. conda. An example of COM path error
- What if the DataGrid cannot see the table after connecting to the database
猜你喜欢
Opendrive ramp
Target detection series - detailed explanation of the principle of fast r-cnn
Thunderbird tutorial \ easy to use mail client
行测--资料分析--fb--高照老师
What is Bezier curve? How to draw third-order Bezier curve with canvas?
2022年PMP项目管理考试敏捷知识点(7)
Basic series of SHEL script (III) for while loop
HDU1231 最大连续子序列(分治or动规or双指针)
Deepin get file (folder) list
2022 PMP project management examination agile knowledge points (7)
随机推荐
static的作用
借助 Navicat for MySQL 软件 把 不同或者相同数据库链接中的某数据库表数据 复制到 另一个数据库表中
Use go language to read TXT file and write it into Excel
Let me teach you how to develop a graphic editor
Differences between pycharm and idle and process -- join() in vs Code
Oracle code use
Hdu1232 unimpeded project (and collection)
Apple animation optimization
Idea to view the source code of jar package and some shortcut keys (necessary for reading the source code)
[neo4j] common operations of neo4j cypher and py2neo
Pit record of Chmod 2 options in deepin
Apple script
Mouse click fireworks explosion effect
NSIS search folder
Deepin get file (folder) list
Today, share the wonderful and beautiful theme of idea + website address
D2L installation
玩转gRPC—深入概念与原理
"Source code interpretation" famous programmer TJ's only library
Cygwin installation