We use cookies.This website uses essential cookies to operate core features. With your consent, we also use analytics cookies to understand traffic and improve the service. For more details, see our .
Java Operator Precedence Checker
If this tool helped you, you can buy us a coffee ☕
Quickly check Java operator precedence with our free online reference tool. Get a complete precedence table and associativity rules for accurate coding.
expr++PostfixLeft-to-Right返回当前值后将变量加 1。
i++expr--PostfixLeft-to-Right返回当前值后将变量减 1。
i--++exprUnaryRight-to-Left先将变量加 1,再返回新值。
++i--exprUnaryRight-to-Left先将变量减 1,再返回新值。
--i+exprUnaryRight-to-Left返回操作数的值,触发数值提升。
+x-exprUnaryRight-to-Left返回操作数的相反数。
-x~UnaryRight-to-Left对整数按位取反,每一位 0 变 1、1 变 0。
~mask!UnaryRight-to-Left对布尔值取反,true 变 false,false 变 true。
!ready(type)UnaryRight-to-Left将表达式显式转换为目标类型,对引用类型会进行 ClassCastException 检查。
(int) 3.14*MultiplicativeLeft-to-Right两个操作数相乘。
a * b/MultiplicativeLeft-to-Right整数除法向零截断;浮点除法保留小数。
10 / 3%MultiplicativeLeft-to-Right返回相除的余数,操作数可以是整型或浮点型。
10 % 3+AdditiveLeft-to-Right数值相加,或与字符串相连进行拼接。
"Hi " + name-AdditiveLeft-to-Right两个数相减。
a - b<<ShiftLeft-to-Right整数按位左移,高位丢弃,低位补 0。
1 << 3>>ShiftLeft-to-Right整数按位右移,保留符号位。
-8 >> 2>>>ShiftLeft-to-Right整数按位右移,高位补 0,Java 独有。
-1 >>> 28<RelationalLeft-to-Right左操作数小于右操作数返回 true。
a < b<=RelationalLeft-to-Right左小于或等于右返回 true。
a <= b>RelationalLeft-to-Right左操作数大于右操作数返回 true。
a > b>=RelationalLeft-to-Right左大于或等于右返回 true。
a >= binstanceofRelationalLeft-to-Right判断对象是否为指定类型或其子类的实例。
obj instanceof String==EqualityLeft-to-Right基本类型比较值;引用类型比较是否为同一对象。
a == b!=EqualityLeft-to-Right基本类型比较值是否不同;引用类型比较是否非同一对象。
a != b&BitwiseLeft-to-Right整数按位与;布尔型表示不短路逻辑与。
a & b^BitwiseLeft-to-Right整数按位异或;布尔型表示逻辑异或。
a ^ b|BitwiseLeft-to-Right整数按位或;布尔型表示不短路逻辑或。
a | b&&LogicalLeft-to-Right短路逻辑与:左操作数为 false 时不计算右操作数。
a && b||LogicalLeft-to-Right短路逻辑或:左操作数为 true 时不计算右操作数。
a || b?:TernaryRight-to-Left根据布尔条件返回两个表达式之一。
x > 0 ? 1 : -1=AssignmentRight-to-Left将右操作数的值赋给左操作数。
x = 10+=AssignmentRight-to-Leftx = x + y 的简写,同样支持字符串拼接。
x += 1-=AssignmentRight-to-Leftx = x - y 的简写。
x -= 1*=AssignmentRight-to-Leftx = x * y 的简写。
x *= 2/=AssignmentRight-to-Leftx = x / y 的简写。
x /= 2%=AssignmentRight-to-Leftx = x % y 的简写。
x %= 3&=AssignmentRight-to-Leftx = x & y 的简写。
x &= 0xFF^=AssignmentRight-to-Leftx = x ^ y 的简写。
x ^= mask|=AssignmentRight-to-Leftx = x | y 的简写。
x |= 0x01<<=AssignmentRight-to-Leftx = x << y 的简写。
x <<= 2>>=AssignmentRight-to-Leftx = x >> y 的简写。
x >>= 2>>>=AssignmentRight-to-Leftx = x >>> y 的简写。
x >>>= 2->Lambda ExpressionsRight-to-LeftJava 8 引入的 Lambda 表达式,将参数列表与函数体分隔。
(a, b) -> a + b
Java Regex Tester
Test Java regular expressions online. Real-time match verification and capture group extraction for faster debugging and development.

JSON to Java POJO Generator
Automatically convert JSON strings into standard Java POJO class code for API integration, data modeling, and other development scenarios.

JavaScript Events Reference Table & Compatibility List
An online reference guide for front-end developers to quickly look up JavaScript event names, categories, and browser compatibility.
When writing Java expressions, operator precedence and associativity can easily be confused, leading to logic errors. This tool provides a complete Java operator precedence table, covering all 15 levels from highest to lowest. It helps developers quickly look up rules and avoid bugs caused by precedence misunderstandings. Following the Java Language Specification, it clearly lists the precedence, associativity, and description of each operator.
a + b * c, because * has a higher precedence than +, multiplication is evaluated before addition.(), [], and ., along with unary operators such as ++, --, !, and ~, have the highest precedence.a = b = c is equivalent to a = (b = c).This tool displays standard Java operator precedence and does not apply to other programming languages. It is highly recommended to use parentheses in your expressions to explicitly define the evaluation order and improve readability, even if the default precedence is correct. Some operators may have different meanings depending on the context, so please verify their specific usage.
Remember common precedence rules: unary operators are higher than binary ones, multiplication/division is higher than addition/subtraction, and relational operators are higher than logical AND/OR. If you are ever unsure about the evaluation order during development, simply add parentheses to prevent ambiguity. Precedence and associativity are frequently tested in technical interviews and exams, so understanding this table is highly recommended.