Java quiz of the day (easy): what gives
Object[] a = new Integer[]{};List<Object> b = new ArrayList<Integer>();
Response: we get an exception on the second line:
Type mismatch: cannot convert from…
What gives:
Integer a = 100, b = 100;Integer c = 200, d = 200;System.out.println( (a == b) == (c == d) ); // A
Response: counter intuitively, the program prints ‘false’ out. Integer in Java is a non-native class, where ‘==’ means…
What gives
Double a = null;Double b = a == null ? a : 1.0;
Response: as strange as it can seem at first look, b is not equal to null after the second statement, but the code produces a NullPointerException.