Operators in JAVA: Learn in an easy way
Operators in Java: solved Java program for ICSE Class 9 Computer Applications with complete BlueJ code, explanation and sample output.
In this program, arithmetic operators are used.
Variables and Data type
class operators
{
public static void main()
{
int a=10;
int b=2;
int sum=a+b;
int subtract=a-b;
int product=a*b;
int divide=a/b;
int modulus=a%b;
System.out.println("The sum is "+sum);
System.out.println("The minus of a & b is "+subtract);
System.out.println("The product is "+product);
System.out.println("The quotient is "+divide);
System.out.println("The modulus is "+modulus);
}
}OUTPUT:
The sum is 12
The minus of a & b is 8
The product is 20
The quotient is 5
The modulus is 0
Watch Java videos
Related Posts
Continue learning with these related articles

String Methods in Java for ICSE Class 10: 25 Output Questions with Answers
ICSE Class 10 Computer Applications practice on String class methods: length, charAt, indexOf, lastIndexOf, substring, replace, trim, compareTo, equals and more, with 25 board-style output questions and step-by-step answers.

Special Number Programs in Java for ICSE: Armstrong, Spy, Neon, Disarium, Pronic and More
Every special number asked in ICSE Computer Applications – prime, perfect, Armstrong, palindrome, automorphic, neon, spy, Niven, duck, buzz, Disarium, special and pronic numbers – with definitions, examples and one complete Java program that checks them all.

Math Library Methods in Java for ICSE Class 9 (with Outputs)
ICSE Class 9 Computer Applications notes on the Java Math class: sqrt, cbrt, pow, abs, max, min, ceil, floor, round, rint and random, with return types, tricky negative-number outputs and Java expressions for formulas.