Post increment
int x=10;
x=x+1;
System.out.println(“x”);
————————————->>>>Output :-11
int x=10;
x++; //increment by one.
System.out.println(“x”);
—————————————->>>>Output :-11
int x=10;
System.out.println(“x++”); //Here,first print the x value then, increment by one.
—————————————–>>>> Output :-10
System.out.println(“++x”); //Here,first increment the value of x then print x.
———————————>>>Output :- 11
int x=10;
++x; //First increment by one the Print the value.
System.out.println(“x”);
—————————————->>>>Output :- 11
Finally, In this slide we show a assignment operator.
x=x+1;
System.out.println(“x”);
————————————->>>>Output :-11
int x=10;
x++; //increment by one.
System.out.println(“x”);
—————————————->>>>Output :-11
int x=10;
System.out.println(“x++”); //Here,first print the x value then, increment by one.
—————————————–>>>> Output :-10
- Pre increment
System.out.println(“++x”); //Here,first increment the value of x then print x.
———————————>>>Output :- 11
int x=10;
++x; //First increment by one the Print the value.
System.out.println(“x”);
—————————————->>>>Output :- 11
Finally, In this slide we show a assignment operator.
0 Comments:
Post a Comment