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
In questa pagina del sito puoi guardare il video online Difference between a++; and a = a + 1; statements in Java della durata di ore minuti seconda in buona qualità , che l'utente ha caricato VK Programming Villa 13 novembre 2018, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,226 volte e gli è piaciuto 40 spettatori. Buona visione!