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
Auf dieser Seite können Sie das Online-Video Difference between a++; and a = a + 1; statements in Java mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer VK Programming Villa 13 November 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,226 Mal angesehen und es wurde von 40 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!