In this tutorial we’re going to look at very important Java concept difference between a++; and a = a + 1; statements according to the SCJP/OCJP Exam as well as technical interview point of view and learn it with small small examples in detail.
In this tutorial, we will learn about a = a + 1; statement in example 2 in which this statement will generates compile time error saying, error: incompatible types: possible lossy conversion from int to byte.
The Reason behind is If we apply any arithmetic operator ( +,-, *, /, %) between two byte type, short type or int type variables a and b, the return type is always max( int, type of a, type of b).
In Example 3, we learn about a++; statement which is postfix increment statement and in this case, error will not occur, because the reason behind is, in the case of increment and decrement operator, internal type casting will be performed automatically.
#java #incrementOperator #incompatibleTypes #a++ #a=a+1 #SCJP #OCJP #Interview #Programming #Tutorials
Social Links: Don't hesitate to contact me if you have any further questions.
FACEBOOK: / cse.programming.assignments
GOOGLE+ :
https://plus.google.com/u/0/114693282...
Quora: https://www.quora.com/profile/Vinay-K...
Related Videos: • OCJP-SCJP Exam / Java Interview Preparation
Gmail: vkprogrammingvilla.com
Sur cette page du site, vous pouvez voir la vidéo en ligne Difference between a++; and a = a + 1; statements in Java durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur VK Programming Villa 13 novembre 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 2,233 fois et il a aimé 40 téléspectateurs. Bon visionnage!