Notable things in java

No support for unsigned integers (Other than char). 
int[] test = new int[-1]; // Negative sized Array Exception

IdentityHashMap: violates Map contracts by using reference equality (not .equls()) during put/get operations

Math.abs() returns absolute value  except if the argument is equal to the value of Long.MIN_VALUE, the most negative long value, the result is that same value, which is negative (This is due to overflow).

You cannot initialize static final field with in constructor, because construtor is called for every instance created and the static final field will get initialized on every instance. [this is obvious but you still can’t, even if your intent is to create a single instance by making the constructor private, ofcourse you still can create multiple instances with in the declaring class.]

Unlike HashMap Concurrent Hash Map (CHM) & ConcurrentSkipListMap (CSLM) doesn’t take null keys or values.  http://cs.oswego.edu/pipermail/concurrency-interest/2006-May/002485.html.

null is not an instanceof any java type.

Advertisements

instanceof vs class.isInstance

instanceof is resolved and compile time where as class.isInstance() is dynamic in the sense that

String x =””;

x instanceof String => true. The only limitation is that instanceof takes 2 operators one a variable and the other variable is class name which is constant and determined at compile time.

In class.isInstance() class doesn’t need to be determined at compile time, it can be a variable and resolved at runTime.

null is not an instanceof any java type.