In this video you will learn what are the increment decrement operators and their types. You will also learn that what is the difference between postfix increment and prefix increment.
The increment operator increases value of its operand by 1.The decrement operator decreases the value of the operand by 1.
int a=10;
a++;
a will store 11
int b=10;
b--;
b will store 9
Prefix Form
When I/D is written before the operand then it’s called prefix form.
Example :
int a=10;
++a;
int b=20;
--b;
Postfix Form
When I/D is written after the operand then it’s called postfix form.
int a=10;
a++;
int b=20;
b--;
Example:
class IncrementDecrement
{
public static void main(String[]args)
{
int a=10;
int b=--a;//a=a-1,b=a,a=9,b=9
System.out.println("a is "+a);
System.out.println("b is "+b);
}
}
www.tarunsir.com
www.cinstitute.org.in
Connect me on linkedin / tarrunverrma
/ the_ultimate_coding_stuff
#tarunsir #javatutorial #learnprogramming #incrementoperator #decrementoperator
On this page of the site you can watch the video online Increment Decrement Operator in java in hindi with a duration of hours minute second in good quality, which was uploaded by the user Tarun Sir 01 January 1970, share the link with friends and acquaintances, this video has already been watched 422 times on youtube and it was liked by 17 viewers. Enjoy your viewing!