4.5 Post and Pre Increment in Java

  Рет қаралды 208,338

Telusko

Telusko

8 жыл бұрын

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
@snehajaiswal5778
@snehajaiswal5778 6 жыл бұрын
Increment confused me always! Thank you for this wonderful explanation :)
@kesikajeevathayaparan4157
@kesikajeevathayaparan4157 4 жыл бұрын
A very clear explanation I found. Thank you so much. Really appreciate your work.
@inderpreetsingh1995
@inderpreetsingh1995 5 жыл бұрын
Thank uh sir ...! You made it easy for us itzz just a small concept but confusing also
@mohit6258
@mohit6258 5 жыл бұрын
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
@praveermadhupushpa6518 4 жыл бұрын
try debugging and then execute bro
@saishmhatrearts
@saishmhatrearts 8 жыл бұрын
sir i watched today ur oop playlist its awesome....!!!!
@appleberry2935
@appleberry2935 5 жыл бұрын
Thanks for explaining a short and understandable concept that even some technical books fail to.
@madhavanand756
@madhavanand756 6 жыл бұрын
The only best tutor for computer on KZbin 😎
@nilesh122n
@nilesh122n 8 жыл бұрын
very good,really helpful for me.
@zeyadjy7229
@zeyadjy7229 4 жыл бұрын
so this is why in a for loop the i++ will affect the loop counter after the first execution of the loop?
@saadafm
@saadafm 4 жыл бұрын
Thanks! Great explanation
@faizansadique5769
@faizansadique5769 4 жыл бұрын
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
@marvhartigan3677 3 жыл бұрын
hehe
@shirsho22
@shirsho22 6 жыл бұрын
Quite helpful !
@user-wg6ud3hh1n
@user-wg6ud3hh1n 9 ай бұрын
CLear explanation.thank you
@saishmhatrearts
@saishmhatrearts 8 жыл бұрын
now i head up with this playlist witch contains 174 video for biginners...thank you...!!!
@parasarora2606
@parasarora2606 8 жыл бұрын
sir ,this mean that assignment operator having high priority over post increment and pre increment
@vineethsaivarada1961
@vineethsaivarada1961 6 жыл бұрын
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.
@hearttouchingmotivation6603
@hearttouchingmotivation6603 4 жыл бұрын
Awesome work
@akhilsuresh9536
@akhilsuresh9536 7 жыл бұрын
Sir, is this an exception? In all other cases, the value of increments gets reflected from the next line itself!!!
@drakshayanibakka11
@drakshayanibakka11 4 жыл бұрын
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
@-indeed8285
@-indeed8285 6 жыл бұрын
amazing videos
@girlstjohnian
@girlstjohnian 3 жыл бұрын
Thank you so muchhhhh sir!!
@shuvshaw9594
@shuvshaw9594 4 жыл бұрын
Very helpful
@mithileshchandra2072
@mithileshchandra2072 2 жыл бұрын
Awesome 👍
@aniruddhamukherjee5099
@aniruddhamukherjee5099 2 жыл бұрын
thanks for the video
@chagantisrichandana8422
@chagantisrichandana8422 4 жыл бұрын
Thank u Reddy sir
@SmartProgramming
@SmartProgramming 6 жыл бұрын
nice explanation sir, it easy to learn java from you, thanks 👍👍
@sivapradeep977
@sivapradeep977 3 жыл бұрын
Is it same for all versions sir.....???
@ikramasharfi5047
@ikramasharfi5047 7 жыл бұрын
sir pls add some java questions of output printing, i m very poor in that
@NarendraKolink
@NarendraKolink 8 жыл бұрын
Thanks..a lot...
@JeevanJeevDb
@JeevanJeevDb 3 жыл бұрын
Really cool
@kiranthakur5743
@kiranthakur5743 4 жыл бұрын
Can we increase more than 1 number by using post and pre increment
@JesusSaves-007
@JesusSaves-007 3 жыл бұрын
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
@gobinathg5101
@gobinathg5101 6 жыл бұрын
Great!
@Fosten12
@Fosten12 9 ай бұрын
i finally understood it
@Namakarana
@Namakarana 4 жыл бұрын
If temp=i what will be the output
@nightshadow591
@nightshadow591 2 жыл бұрын
Tysm 👍
@Mrtargetlocked
@Mrtargetlocked 4 жыл бұрын
Thankyou
@vidhyapriyadharsini234
@vidhyapriyadharsini234 5 жыл бұрын
Thanks
@aniruddwakikar3004
@aniruddwakikar3004 4 жыл бұрын
Is it good to learn java 8 in 2020
@lokeshmotwani6121
@lokeshmotwani6121 5 жыл бұрын
Thanku sir
@justfeelmusic162
@justfeelmusic162 3 жыл бұрын
Can you explain when j : i , How it comes i=6
@S2KEVIN
@S2KEVIN 3 жыл бұрын
bravo sir
@teengod1520
@teengod1520 3 жыл бұрын
Arigato!! 💜
@friedchicken5227
@friedchicken5227 3 жыл бұрын
👍 thanks
@NarendraKolink
@NarendraKolink 8 жыл бұрын
Does this same thing happened in c++ ?? Just like java. does c++ also use temp variable while i = i++ ??
@varunaggarwal1995
@varunaggarwal1995 7 жыл бұрын
Collections and Generics
@venkatgadamsetty3584
@venkatgadamsetty3584 7 жыл бұрын
Telusko Learnings wo w
@venkatgadamsetty3584
@venkatgadamsetty3584 7 жыл бұрын
How can i write outpits for programs easily
@venkatgadamsetty3584
@venkatgadamsetty3584 7 жыл бұрын
Pls give me the reply i have much time
@venkatgadamsetty3584
@venkatgadamsetty3584 7 жыл бұрын
Or show me the video
@onlineworld3838
@onlineworld3838 2 жыл бұрын
Thank you sir form omprakash
@lokeshmotwani6121
@lokeshmotwani6121 5 жыл бұрын
Can you tell this a=6 ,b=3 +a-- +10
@krishna_rohith244
@krishna_rohith244 4 жыл бұрын
15
@Rohan-rd8ru
@Rohan-rd8ru 3 жыл бұрын
6:20 you printed i instead of temp
@sahilchauhang
@sahilchauhang 8 жыл бұрын
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
@avvahfarhana8395 8 жыл бұрын
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
@sahilchauhang 8 жыл бұрын
Thanks
@akashjadhav8345
@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 ....
@rishiganeshbandaru9812
@rishiganeshbandaru9812 Жыл бұрын
are u telugu sir??
@pranathipalli2086
@pranathipalli2086 4 жыл бұрын
i=++i gives 6 please explain it
@thewatcher8657
@thewatcher8657 2 жыл бұрын
Because pre increment works that way
@shantikallagunta6917
@shantikallagunta6917 5 жыл бұрын
All the operations are not shown properly.. Can you clearly keep a video..
@CodeThrill
@CodeThrill 5 жыл бұрын
Luv
@venkateswarluguntaka7370
@venkateswarluguntaka7370 4 жыл бұрын
@ravikaushish
@ravikaushish 7 жыл бұрын
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
@aniruddwakikar3004
@aniruddwakikar3004 4 жыл бұрын
Pls reply sir
@unknownunknown8699
@unknownunknown8699 2 жыл бұрын
6:50 not cool confusing.
@asnakeseyoum3109
@asnakeseyoum3109 2 жыл бұрын
who is watching this video after seeing in the question that is asked?
@-TEST-0
@-TEST-0 5 ай бұрын
i will never understand....
@theengineer8301
@theengineer8301 6 жыл бұрын
Not at all helpful. The guy is himself in doubt. Tremendously confusing explanation.
@shivangianand6341
@shivangianand6341 6 жыл бұрын
worse explanation really here u r still confused
@akashjadhav8345
@akashjadhav8345 6 жыл бұрын
very Helpful Video... Are you serious... worse explanation really here u r still confused
@adityasankarsadhukhan6389
@adityasankarsadhukhan6389 6 жыл бұрын
worst explanation i ever saw
@akashjadhav8345
@akashjadhav8345 6 жыл бұрын
Very nice Teaching Skills
@yaoyaoxiong2371
@yaoyaoxiong2371 4 жыл бұрын
bro thats mean
Java Strings are Immutable - Here's What That Actually Means
7:06
Coding with John
Рет қаралды 609 М.
Java Basics - Increment Decrement Operators
10:26
MargretPosch
Рет қаралды 72 М.
Это реально работает?!
00:33
БРУНО
Рет қаралды 4 МЛН
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
MrBeast
Рет қаралды 117 МЛН
No empty
00:35
Mamasoboliha
Рет қаралды 11 МЛН
C Programming Tutorial   8 Pre and Post Increment
4:41
Telusko
Рет қаралды 251 М.
#52 Method Overriding in Java
7:57
Telusko
Рет қаралды 125 М.
Prefix and Postfix (++x vs x++) in Java
6:12
Bill Barnum
Рет қаралды 31 М.
This Keyword in Java Full Tutorial - How to Use "this"
7:39
Coding with John
Рет қаралды 142 М.
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,5 МЛН
Map and HashMap in Java - Full Tutorial
10:10
Coding with John
Рет қаралды 556 М.