Long l1 = null;
Long l2 = Long.getLong("23");
Long l3 = Long.valueOf(23);
System.out.println(l1 instanceof Long); // returns false
System.out.println(l2 instanceof Long); // returns false
System.out.println(l3 instanceof Long); // returns true
I could not understand the output returned. I was expecting true atleast for 2nd and 3rd syso's. Can someone explain how instanceof works?