ICSE Class 10 · Computer Applications (Java) · Operators 2027

Operators in Java for ICSE Class 10, evaluated one step at a time.

Operators in Java for ICSE Class 10 are a Class 9 chapter that keeps returning in the board paper, mostly as one question: what is the value after a line full of ++ and --? This page answers that with a fixed method and twelve worked examples, then covers operator precedence, the ternary operator, compound assignment and writing formulas as Java expressions. Every value was checked by running the code in Java 21. In our live mini batch these are timed, traced aloud and run in BlueJ.

Live online · 12 increment traps worked · precedence table · ternary conversions · first class free

Start here

Courses that teach expressions properly

The ICSE Java course where the mini batch works these expressions every week, the Class 11 and 12 Computer Science course where the same operators carry into ISC programs, and the data structures course for students who like exact, step-by-step reasoning.

Ans. The short version

Operators in Java for ICSE Class 10 come in six families: arithmetic, relational, logical, assignment (with compound forms such as +=), increment and decrement, and the ternary operator. The most asked question is a++ + ++a style evaluation. The rule: Java reads operands left to right; a postfix operator hands over the old value and then changes the variable, a prefix operator changes it first; only then do precedence rules combine the values. We drill these expressions live twice a week in an Indian evening mini batch, and privately one to one at a time that suits the family.

Q1. What are the types of operators in Java?

Types of operators in Java for ICSE Class 10

An operator is a symbol that performs an operation on one, two or three operands. ICSE classifies them two ways: by job (arithmetic, relational, logical and so on) and by the number of operands (unary, binary, ternary). Both appear in Section A.

FamilyOperatorsOperandsExampleResult type
Arithmetic+ - * / %Binary17 % 5 gives 2Number
Unary minus and plus- +Unary-xNumber
Increment, decrement++ --Unaryn++, --nNumber (also char)
Relational== != < > <= >=Binary8 >= 8 gives trueboolean
Logical&& || !Binary, ! is unary!(3 > 1) gives falseboolean
Assignment=Binarytotal = 0Type of the left side
Compound assignment+= -= *= /= %=Binaryq *= 3 means q = q * 3Type of the left side
Ternary (conditional)? :Ternary, the only onea > b ? a : bThe common type of the two branches
String join+ with a StringBinary"Class " + 10String
Object creationnewUnarynew int[5]A reference

Two facts students drop marks on: / between two ints throws away the fraction, and % keeps the sign of the left operand. The full set of division traps sits on ICSE Java output questions, and the types that decide every result are on data types and type casting for ICSE Class 10.

Q2. How do you solve a++ + ++a questions?

Increment and decrement questions ICSE: the four-step method

Evaluate operands strictly left to right, write down the value each one hands over and what the variable becomes, and only after that apply * / % before + -. Postfix (a++) hands over the old value; prefix (++a) changes the variable first and hands over the new one.

  1. Write the starting values

    Put every variable in a row at the top of your working, with its value before the statement runs.

  2. Go operand by operand, left to right

    For each operand write two things: the value used in the expression, and the variable's value after it. A plain variable just hands over its current value.

  3. Now apply precedence to the values

    Replace each operand with its value and work the arithmetic: * / % first, then + -, left to right within a level.

  4. Assignment happens last

    The = (or +=) writes its result after everything on the right is done, overwriting any change an increment made to the same variable.

Worked example 1prefix, postfix, then plain
int a = 4;
int b = ++a + a++ + a;
System.out.println("a=" + a + " b=" + b);

// Output: a=6 b=16

The third operand is a plain a, but by then two increments have already run, so it is 6, not 4.

OperandValue useda after
++a55
a++56
a66
5 + 5 + 6b = 166
Worked example 2increments meet precedence
int p = 3;
p = p++ + p++ * ++p;
System.out.println("p=" + p);

// Output: p=27

Precedence does not change the order the operands are read. Java collects 3, 4 and 6 left to right, and only then does * bind before +: 3 + 4 * 6.

OperandValue usedp after
p++34
p++45
++p66
3 + 4 * 6276
assigned to p2727

Ten more increment and decrement questions, with answers

#CodeResultValues in order
3int x = 10;
int y = x-- - --x + x++;
x = 9, y = 1010 (x 9), 8 (x 8), 8 (x 9): 10 - 8 + 8
4int m = 7, n = 2;
m += m++ % n + --n;
m = 9, n = 1Left m saved as 7; m++ gives 7, 7 % 2 is 1; --n gives 1; 7 + (1 + 1)
5int a = 5;
a = a++ + a--;
a = 115 (a 6), 6 (a 5), then 11 overwrites the 5
6int i = 2;
i = i++ * i--;
i = 62 (i 3), 3 (i 2): 2 * 3
7int k = 9;
int r = k-- / 2 + --k % 3;
r = 5, k = 79 (k 8), 9 / 2 is 4; 7 (k 7), 7 % 3 is 1
8int s = 1;
s = s + s++ + ++s;
s = 51, 1 (s 2), 3 (s 3): 1 + 1 + 3
9int a = 2, b = 3;
a = a++ * --b + b++ * a;
a = 10, b = 32 (a 3), 2 (b 2), 2 (b 3), 3: 2 * 2 + 2 * 3
10int a = 3;
a += a++ + a;
a = 10Left a saved as 3; 3 (a 4), 4: 3 + (3 + 4)
11int z = 6;
z--;
--z;
z = 4On their own line, prefix and postfix do the same thing
12char c = 'A';
c++;
c += 2;
c = D++ and += keep the char type, so c moves A, B, D

Question 11 is the free mark: when ++ or -- stands alone as a statement, prefix and postfix are identical. The difference shows only when the value is used inside a bigger expression. More fragments of this kind, mixed with other traps, are on ICSE Computer Applications MCQ questions.

Q3. What is the order of precedence of operators in Java?

Operator precedence in Java for ICSE, with associativity

Precedence decides which operator binds first when several share an expression; associativity decides the order between operators of the same level. Brackets override both. The table runs from highest to lowest for the operators in the syllabus.

LevelOperatorsAssociativity
1( ) brackets, [ ] array index, . member accessLeft to right
2Postfix a++ a--Left to right
3Prefix ++a --a, unary + -, !, cast (type)Right to left
4* / %Left to right
5+ - (and String +)Left to right
6< <= > >=Left to right
7== !=Left to right
8&&Left to right
9||Left to right
10? :Right to left
11= += -= *= /= %=Right to left

Precedence worked on real expressions

ExpressionStepsValue
8 + 12 / 4 * 2 - 3 % 212 / 4 = 3, 3 * 2 = 6, 3 % 2 = 1, then 8 + 6 - 113
-3 * -2 + 7 % -4Unary minus first; 6 + 3 (the remainder takes the sign of 7)9
20 - 6 - 4 and 64 / 8 / 2Left to right: (20 - 6) - 4, (64 / 8) / 210 and 4
2 + 3 * 4 > 10 && 15 % 4 == 3Arithmetic, then > and ==, then &&: true && truetrue
5 > 3 && 2 > 4 || !(7 == 7)&& before ||: (true && false) || falsefalse
10 + 5 + "Java" + 10 * 2* first gives 20; then left to right: 15, "15Java", "15Java20"15Java20
int a = 4, b;
b = a = a * 2 + 1;
= is right to left: a gets 9, then b gets aa = 9, b = 9

A common slip: high precedence for postfix ++ does not mean it runs "first" across the whole line. It binds tightly to its own variable; the operands are still read left to right, as worked example 2 showed.

Q4. What is the ternary operator in Java?

Ternary operator ICSE: syntax, if-else conversion and nesting

The ternary operator, condition ? value1 : value2, gives value1 when the condition is true and value2 when it is false. It is the only Java operator with three operands, and ICSE often asks students to rewrite an if-else with it, or the reverse.

if-elseas a student writes it first
int age = 16;
String msg;
if (age >= 18)
    msg = "Adult";
else
    msg = "Minor";
System.out.println(msg);

// Output: Minor

Both branches assign to the same variable. That is the sign an if-else can become one ternary line.

Ternarythe same logic in one line
int age = 16;
String msg = age >= 18 ? "Adult" : "Minor";
System.out.println(msg);

// Output: Minor

The condition, then ?, the true value, then :, the false value. No semicolons inside and no braces.

TaskTernary codeResult (run)
Largest of three: a = 14, b = 29, c = 21int big = a > b ? (a > c ? a : c) : (b > c ? b : c);29
Sign of n = -8String s = n > 0 ? "positive" : n < 0 ? "negative" : "zero";negative
Free delivery above 500 for amount = 650double fee = amount >= 500 ? 0 : 40;0.0
Leap year for y = 2024boolean leap = (y % 4 == 0 && y % 100 != 0) || y % 400 == 0;
System.out.println(leap ? "leap" : "not leap");
leap

Two notes. The nested ternary for the sign reads right to left: everything after the first : is itself a ternary. And the fee prints 0.0, not 0, because the result is stored in a double; the type of a ternary result is part of the answer. When a decision has more than two or three branches, an if-else-if ladder or a switch is clearer, as on menu driven programs in Java for ICSE.

Q5. How do compound assignment and Java expressions work?

Compound assignment and writing Java expressions for formulas

A compound operator such as q *= 3 + 2 means q = q * (3 + 2): the whole right side is worked first. It also casts the result back to the type of the variable silently, which a plain = will not do.

CodeResult (run)Why
int q = 20;
q %= 6;
q *= 3 + 2;
1020 % 6 is 2; then 2 * (3 + 2), not 2 * 3 + 2
int t = 17;
t /= 4;
t -= 2 * 3;
-217 / 4 is 4 in int; 4 - 6
short s = 10;
s += 5.7;
15+= works out 15.7 and casts it back to short
short s = 10;
s = s + 5.7;
Does not compilejavac: incompatible types: possible lossy conversion from double to short

Write the Java expression: a Section A favourite

MathsJava expressionChecked with
ut + ½at²u * t + 0.5 * a * t * tu = 10, t = 4, a = 3 gives 64.0. Writing 1 / 2 gives 40.0, because 1 / 2 is 0 in int
(a + b) / 2ab(a + b) / (2 * a * b)a = 2, b = 3 gives 0.4166666666666667. Without the second bracket it is 15.0
√(b² − 4ac)Math.sqrt(b * b - 4 * a * c)a = 1, b = -5, c = 6 gives 1.0
|x − y|³Math.pow(Math.abs(x - y), 3)x = 2, y = 5 gives 27.0
P(1 + r/100)np * Math.pow(1 + r / 100.0, n)int p = 1000, r = 10, n = 2 printed 1210.0000000000002, a normal floating point tail. With r / 100 it printed 1000.0, since 10 / 100 is 0

Two rules cover most of these marks: put brackets round every denominator and every numerator with more than one term, and never let an int / int stand where a fraction is meant. The return type of each Math method is listed on Math library methods for ICSE Class 10.

Q6. How are operator questions practised in class?

How the mini batch drills operators and expressions

Students learn this chapter by writing the value of each operand before writing any answer. The class is built so they cannot skip that step.

  1. Tuesday: a timed expression set

    At 5:30 PM IST each student gets a sheet of increment, precedence and ternary items and five minutes per block. Answers go on paper with the operand-by-operand working.

  2. Each line run in BlueJ

    The teacher runs every expression while the batch watches, so a wrong value is settled by Java, not by argument.

  3. The wrong step found aloud

    A student whose answer differed reads out their working until the operand where it went wrong. In this chapter it is nearly always a postfix value or an assignment overwriting an increment.

  4. Wednesday: expressions inside programs

    At the 8:00 PM IST class the week's program uses the same operators for real work, such as compound interest with Math.pow or a ternary grade, so the rules stick in context.

  5. Expressions inside mock papers

    Once December arrives, the two-hour practice papers carry increment, precedence and formula items in Section A, graded as strictly as the board grades them.

Operators feed straight into loop conditions and counters; those are drilled on loop programs for ICSE Class 10, and expressions written with one wrong operator turn up on ICSE Java error finding questions.

Batch or personalised: you choose

Practise operators in the mini batch, or one to one

The worked method, the timed sets and the BlueJ checks are the same in either format. In India, choose the evening mini batch or a private slot; ICSE students outside India learn one to one. Billing is monthly, with no admission fee.

Option 1 · Fixed batch timings

Mini batch, Tuesday 5:30 PM and Wednesday 8 PM

₹2,999

per month, two live classes a week

  • Live at 5:30 PM IST Tuesday and 8:00 PM IST Wednesday
  • A batch capped at six ICSE students
  • Timed increment and precedence sets each Tuesday
  • Every expression run in BlueJ on a shared screen
  • Wrong working traced back to the exact operand
Book a free demo in this batch

Option 2 · Choose your own timing

Personalised one to one

₹4,999

per month, one private class a week, at a time set with you

  • A slot the family picks, in India or abroad
  • Extra sets on the operator family your child keeps missing
  • Formula-to-expression practice from their maths and physics
  • Pace set by the student, not the group
  • Same teachers, same 2027 syllabus, same BlueJ checks
Ask for a personalised plan

A student who understands Java but keeps losing a mark or two to increments and integer division can often fix it in a few focused one to one sessions. A student who wants the whole syllabus practised steadily, Section A and Section B, gains more from two batch classes a week. Fees appear in your own currency.

Studying outside India?

Operator practice for ICSE students abroad

An ICSE school in Dubai or Singapore sits the same Computer Applications paper, and Java evaluates a++ + ++a the same way everywhere. Outside India the drills run one to one, after school in the student's own time zone.

Where you liveTime differenceUsual class window, local timeFormat
India (IST)
every Indian city
ISTTue 5:30 PM, Wed 8:00 PMMini batch or 1-on-1
United Arab Emirates
Dubai, Sharjah
1 h 30 min behind India3:00 PM to 9:00 PMPersonalised 1-on-1
Indonesia and Thailand
West Java, Bangkok area
1 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 1-on-1
Singapore
Singapore
2 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 1-on-1

The slot is agreed after the free demo and can move around school tests. The overseas arrangement is described on ICSE Computer Applications classes in the Gulf and abroad.

What families say

Rated 4.9 across 547 Google reviews

Real reviews from real families. We neither write nor commission them.

★★★★★

"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."

Ria Mukherjee

Parent

★★★★★

"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."

Samriddha Mondal

Student

★★★★★

"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."

Vansh Agarwal

Student

★★★★★

"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."

Sonam Oswal

Parent of Dhairya

★★★★★

"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."

Sonu Goyal

Parent

★★★★★

"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."

Ritu Kedia

Parent

The rest of the Class 10 series

More pages for Class 10 board students

Every page in the ICSE Class 10 Computer Applications series, grouped by what you need: classes, each chapter, Section B programs, question practice, notes and revision, and the exam itself.

CBSE Class 10 AI (417): The Mon and Wed 9 PM AI batch CBSE AI 417 syllabus explained CBSE AI important questions Sample paper and mock tests

Questions about operators

What students ask about operators in Java for ICSE

What is the difference between a++ and ++a in Java?

Both increase a by 1. a++ is postfix: it hands the current value to the expression and then increases a. ++a is prefix: it increases a first and hands over the new value. With a = 5, b = a++ makes b 5, while b = ++a makes b 6. In both cases a ends as 6.

How do you solve a++ + ++a in Java?

Go left to right. With a = 5, a++ hands over 5 and a becomes 6; then ++a makes a 7 and hands over 7. The sum is 5 + 7 = 12 and a ends at 7. Write the value used and the new value of a for each operand before adding anything.

What is the precedence of operators in Java for ICSE?

From high to low: brackets, postfix ++ and --, prefix ++ and --, unary minus and !, then * / %, then + -, then the comparisons less than and greater than, then == and !=, then &&, then ||, then the ternary operator, and finally the assignment operators. Brackets always override the order.

What is the ternary operator in Java with an example?

It is the conditional operator: a condition, a question mark, a value for true, a colon and a value for false. Java returns the first value when the condition is true and the second otherwise. For example, a one-line statement can store "even" or "odd" in a String depending on whether n % 2 == 0. It is the only Java operator with three operands.

How do you convert if-else to the ternary operator?

Check that both branches assign a value to the same variable. Then write that variable and =, followed by the condition, a question mark, the value from the if branch, a colon, and the value from the else branch, ending with one semicolon. The two assignments and the if-else keywords disappear, and the line does exactly the same job.

What is the difference between = and == in Java?

= is the assignment operator: it stores the value on its right in the variable on its left. == is a relational operator: it compares two values and gives true or false. Writing if (x = 5) with an int x does not compile, because the condition of an if must be boolean.

What is the difference between / and % in Java?

/ gives the quotient and % gives the remainder. With two ints, 17 / 5 is 3, because the fraction is dropped, and 17 % 5 is 2. With a negative left operand the remainder is negative: -17 % 5 is -2. The pair is used in every digit-extraction program.

What are unary, binary and ternary operators?

They are grouped by how many operands they take. Unary operators take one, such as ++, --, unary minus and !. Binary operators take two, such as + - * / %, == and !=, && and ||. The ternary conditional operator takes three: a condition and two values.

Does x += 1 do the same as x = x + 1?

For an int x, yes. The difference shows with smaller types: for a short or char variable, x += 1 compiles because compound operators cast the result back automatically, while x = x + 1 does not compile, because x + 1 is an int and needs an explicit cast.

Do you teach operators in the live ICSE classes?

Yes. Operators are revised early in the year and then practised every week through timed Tuesday sets at 5:30 PM IST, with every expression run in BlueJ on a shared screen. They also appear inside the Wednesday programs and the board-style mock tests. Personalised one to one classes are available at a time the family chooses.

Start

Book a free live class on operators

In the free demo your child works a short set of increment, precedence and ternary questions with the mentor, writing the value of each operand, and then sees each line run in BlueJ. You then hear honestly where the marks are slipping and whether the mini batch or one to one would suit your child better.

Want more practice first? Try ICSE Java output questions or see the ICSE Class 10 Java classes.

WhatsApp us · +91 91233 66161 · connect@modernagecoders.com

Every class is live video. The form requests a callback and reserves nothing.

We call within a few hours. No card, no enrolment fee.

Want it sooner? Book a priority demo

A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.

Book a priority demo

Keep exploring Modern Age Coders

By class and age

Learn more

Free resources

From the blog

Start here