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 .
Was this tool helpful to use?
Your feedback helps us make it better
Quickly check Java operator precedence with our free online reference tool. Get a complete precedence table and associativity rules for accurate coding.
A curated syntax reference, not a compiler or example validator. Local group numbers do not replace version-specific grammar, typing or evaluation rules. Examples keep their original code and literals. Reference
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 + bOverview
Understand what the tool solves, how it works, and the boundaries of its data.
This page is a searchable reference for the Java operator entries it lists. Search by a symbol such as >>>, a term such as instanceof, a description or example, or a displayed precedence number. Each matching entry shows its symbol, category, associativity label, short explanation and sample expression. The displayed numbers run from lower numbers for higher precedence to higher numbers for lower precedence.
Precedence helps show how a parser groups parts of an expression. For example, a + b * c groups like a + (b * c), because multiplication binds more tightly than addition. Parentheses can make a different grouping explicit: (a + b) * c. Associativity is a separate grouping rule used when operators at the same precedence level occur in sequence; for instance, subtraction groups left to right, so a - b - c is grouped as (a - b) - c.
The Java Language Specification defines expressions through grammar and semantic rules, rather than declaring this page’s numbered groups as a complete official table. Treat the numbers and categories here as a convenient index for the listed entries. Oracle’s Java SE 26 Language Specification, Chapter 15 describes expression syntax, precedence, parentheses and evaluation rules (Oracle; Java SE 26; checked September 29, 2026).
Guide
Follow the workflow and verify inputs and outputs with practical examples.
>>>, shift or 14 can help locate different kinds of entries.The result count reflects entries matching the current search and both filters. If nothing appears, clear one or more filters, try the symbol itself, or search a shorter word. The page finds reference entries; it does not accept a full expression for parsing or compilation.
Use cases
See how the tool fits into real work and everyday tasks.
When a beginner is unsure whether multiplication or addition binds first, search for the symbols and compare their displayed groups. Rewrite the expression with parentheses to confirm the grouping being discussed.
For a mixed condition such as ready && count > 0, look up the comparison and logical operators, then use parentheses in the reviewed code if they make the intended condition easier for teammates to scan.
Search for >>> or filter by shift operators to locate the listed unsigned right-shift entry and inspect its example. Confirm language details against the Java version used by the project when syntax or type behavior matters.
Q&A
Find concise answers to common questions and confusing cases.
No. Precedence determines syntactic grouping. Java’s evaluation rules determine when operands and operations are evaluated; short-circuit operators such as && and || also affect whether the right operand is evaluated.
No. Associativity describes how operators at the same precedence level are grouped. Do not use that label alone to infer every evaluation detail; consult the language specification for evaluation order and side effects.
The search checks listed symbols, names, descriptions, examples and displayed numbers, while category and associativity filters further narrow results. Remove filters or try a shorter symbol or term if the current combination excludes the entry.
No. It is a limited index of entries, and its numbered groups are for lookup convenience. Java syntax includes expression forms and contextual rules that cannot be represented as a complete operator hierarchy by this list.
Notes
Review scope, result limitations, and important precautions before use.
This reference does not parse code, check types, compile expressions or establish that an expression is valid. Its entries and numbered groups are not a complete or normative catalog of Java expression grammar. In particular, lambda syntax, method calls, member access, array access, casts and context-dependent typing require more than a simple operator table. For behavior in a specific Java release, consult that release’s language specification and compiler; use parentheses when you want grouping to be explicit.
Related
Discover related tools, collections, and available API capabilities.