public static void main(String[] args) {
int var = 128;
Integer i = var;
int j = var;
LinkedList<Integer> ll = new LinkedList<>();
ll.add(var);
System.out.println(i==j);
System.out.println(i==ll.peek());
}
Output:
true
false
The values of variable var below number 128 though gives correct output as:
Output:
true
true
Please explain why comparison fails for peek() on values above 127?