Tag Archives: curiosity

JAVA Dynamic Binding – Another Example

In this post I will show you another interesting example of Java Dynamic Binding…

dynamicBindingExample
dynamicBindingExample

Did you expect such behavior? Feel free to comment. Thanks.

Compound assignment operator [i += j] is not same as [i = i + j] in java

from Pocket http://ift.tt/1tMBluS

We all have used syntax’s like i += j and i = i + j thousands of times in our day to day programming. In first sight, they both look similar. In fact, they will result in same output in almost all of the cases in practical cases. But, to surprise you they are not similar.

Did you know…

Consider the following code snippet:

Which one of the following declarations of the variable i will compile without errors and print true when the program runs?

  1. int i = 017;
  2. int i = 15.0f;
  3. int i = 15L;
  4. int i = 15.0;

I will comment out the solution in the next few hours. Stay tunned.