4.5 Post and Pre Increment in Java
The increment operator increases the value of the variable by one .
these operators have two forms each: prefix and postfix. In prefix form, the operand appears before the operand while in post fix form, the operand appears after the operand.
Check out our website: www.telusko.com
Follow Telusko on Twitter: / navinreddy20
Follow on Facebook:
Telusko : / teluskolearnings
Navin Reddy : / navintelusko
Follow Navin Reddy on Instagram: / navinreddy20
Subscribe to our other channel:
Navin Reddy : / @navinreddy
Telusko Hindi :
/ @teluskohindi
Subscribe to the channel and learn Programming in easy way.
Java Tutorial for Beginners: goo.gl/p10QfB
C Tutorial Playlist : goo.gl/8v92pu
Android Tutorial for Beginners Playlist : goo.gl/MzlIUJ
XML Tutorial : goo.gl/Eo79do
Design Patterns in Java : goo.gl/Kd2MWE
Socket Programming in Java : goo.gl/jlMEbg
Spring MVC Tutorial : goo.gl/9ubbG2
OpenShift Tutorial for Beginners : goo.gl/s58BQH
Spring Framework with Maven : goo.gl/MaEluO
Sql Tutorial for Beginners : goo.gl/x3PrTg
String Handling in Java : goo.gl/zUdPwa
Array in Java : goo.gl/uXTaUy
Java Servlet : goo.gl/R5nHp8
Exception Handling in Java : goo.gl/N4NbAW
Пікірлер: 85
Increment confused me always! Thank you for this wonderful explanation :)
A very clear explanation I found. Thank you so much. Really appreciate your work.
Initially I thought of disliking this video. But when i put my brain into it, I found I was doing it all wrong before. This video clears the real concept how increment and decrement operator works. Thanks
@praveermadhupushpa6518
4 жыл бұрын
try debugging and then execute bro
The only best tutor for computer on KZread 😎
Thanks for explaining a short and understandable concept that even some technical books fail to.
Thank uh sir ...! You made it easy for us itzz just a small concept but confusing also
sir i watched today ur oop playlist its awesome....!!!!
I was so much lucky that I got your channel first on my question difference between I++ & ++I you explained it so well or I should say you just spoonfeeded us thanks a lot love from Kolkata
@marvhartigan3677
3 жыл бұрын
hehe
now i head up with this playlist witch contains 174 video for biginners...thank you...!!!
very good,really helpful for me.
so this is why in a for loop the i++ will affect the loop counter after the first execution of the loop?
Thanks! Great explanation
Quite helpful !
nice explanation sir, it easy to learn java from you, thanks 👍👍
sir ,this mean that assignment operator having high priority over post increment and pre increment
Sir, is this an exception? In all other cases, the value of increments gets reflected from the next line itself!!!
Hi Navin... What is the scenario for i = ++i The answer will be 1 incremented to the current value... Can you please provide the internal explaination of it, as done in the video.
CLear explanation.thank you
Awesome work
amazing videos
Thank u Reddy sir
Thank you so muchhhhh sir!!
Thanks..a lot...
Very helpful
Awesome 👍
Is it same for all versions sir.....???
sir pls add some java questions of output printing, i m very poor in that
Great!
hello consider this snippet a=5; b=( --a + a-- ) and when i print b it shows 8 in java and 7 in C both languages showing different outputs . why such difference ? pls help me out
thanks for the video
Can we increase more than 1 number by using post and pre increment
Really cool
i finally understood it
bravo sir
Thankyou
Thanks
Thank you for the uploading and explaining this very clearly however can someone explain how I getting the following results please? Thank you n = 5; System.out.println(n-- - --n); // result is n = 2 x = 5; System.out.println(x++ - --x); // result is x = 0
Thanku sir
Tysm 👍
👍 thanks
Arigato!! 💜
If temp=i what will be the output
Does this same thing happened in c++ ?? Just like java. does c++ also use temp variable while i = i++ ??
@varunaggarwal1995
7 жыл бұрын
Collections and Generics
@venkatgadamsetty3584
7 жыл бұрын
Telusko Learnings wo w
@venkatgadamsetty3584
7 жыл бұрын
How can i write outpits for programs easily
@venkatgadamsetty3584
7 жыл бұрын
Pls give me the reply i have much time
@venkatgadamsetty3584
7 жыл бұрын
Or show me the video
Is it good to learn java 8 in 2020
Can you explain when j : i , How it comes i=6
Thank you sir form omprakash
sir please ans this____ public class PrePost { public static void main(String[] args) { int i = 5; i = i++; System.out.println(i); i = ++i; System.out.println(i); int j = i++; System.out.println(j); int k = ++i; System.out.println(k); } } according to me ans is 5 6 6 7 but when i run this code netbeans it shows: 5 6 6 8 how this is possible?
@avvahfarhana8395
7 жыл бұрын
first: i = i++; as its explained in the video its same as int temp; temp = i; i++; i= temp; so the output will be 5. second: i = ++i; It is a pre Increment. so output will be 6. third: j = i++; the value of i has become 6 from second operation. it assigns 6 to j and then increments i to 6+1 = 7, because i++ is post increment so the value of j=6 and i=7 since you are printing j, output will be 6 fourth: k=++i; here i is pre incremented. the value of i will be 7 from third step, since its a pre increment its first increments the value of i to 8 (7+1), and then assigns it to k. So the output og k=8.
@sahilchauhang
7 жыл бұрын
Thanks
@akashjadhav8345
6 жыл бұрын
Avvah Can you Please help me also... Dear Avvah, Please clear my doubts on Increment/Decrement Operators in JAVA..., Please Observed This code Below.. class Test { public static void main(String[] args) { int a = 10 ; // line 1 a = ++a ; // line 2 a = a++ ; // line 3 System.out.println(a); // line 4 } } Output ::: ---> 11 it is right And Sir, Please observed the following variations also::: Sir, if I am replace //line 3 with this following Expressions so it shows Unexpected Output Sir.. 1) a = a++ + a++ ; replace Line 3 with This Expression Output is :::--> 23 // But, why I am getting 23... instead of 22..... 2) a = a++ + a++ + a++ ; replace Line 3 with This Expression Output is :::--> 36 // I think it is true but,,see below Expression 3) a = a++ + a++ + a++ + a++ ; replace Line 3 with This Expression Output is :::--> 50 // But, why I am getting 50...instead of 48 4) a = a++ + a++ + a++ + a++ + a++; replace Line 3 with This Expression Output is :::--> 65 // But, why I am getting 65... instead of 60 Sir, Please Please Please clear my doubts as early as posiible.....I am very tensed about it ....
did anyone else notice that? In the last video they were working on a windows platform but in this video, they are using a MacBook...congrats sir
❤
Luv
Can you tell this a=6 ,b=3 +a-- +10
@krishna_rohith244
4 жыл бұрын
15
6:20 you printed i instead of temp
All the operations are not shown properly.. Can you clearly keep a video..
i=++i gives 6 please explain it
@thewatcher8657
2 жыл бұрын
Because pre increment works that way
are u telugu sir??
who is watching this video after seeing in the question that is asked?
Pls reply sir
6:50 not cool confusing.
i will never understand....
Not at all helpful. The guy is himself in doubt. Tremendously confusing explanation.
worse explanation really here u r still confused
@akashjadhav8345
6 жыл бұрын
very Helpful Video... Are you serious... worse explanation really here u r still confused
worst explanation i ever saw
@akashjadhav8345
6 жыл бұрын
Very nice Teaching Skills
@yaoyaoxiong2371
4 жыл бұрын
bro thats mean