Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
class Example {
static void main(String[] args) {
// Initializing 3 variables
def x = 5;
def y = 10;
def z = 8;
//Performing addition of 2 operands
println(x+y);
//Subtracts second operand from the first
println(x-y);
//Multiplication of both operands
println(x*y);
//Division of numerator by denominator
println(z/x);
//Modulus Operator and remainder of after an integer/float division
println(z%x);
//Incremental operator
println(x++);
//Decrementing operator
println(x--);
}
}
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more