Increment Decrement Operator in java in hindi

Описание к видео Increment Decrement Operator in java in hindi

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

Комментарии

Информация по комментариям в разработке