πŸ“Š JAVA
Q. What will be the output?
Code:
Integer a = 127;
Integer b = 127;
System.out.println(a == b);
  • (A) true
  • (B) false
  • (C) Compilation Error
  • (D) Runtime Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) true

Explanation: Integer cache works for values -128 to 127, so both refer to same object.

Explanation by: Roshan
Integer cache works for values -128 to 127, so both refer to same object.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
3
Total Visits
πŸ“½οΈ
6 d ago
Published
πŸŽ–οΈ
Roshan
Publisher
πŸ“ˆ
89%
Success Rate