Welcome Guest | Sign in | Register
Final and Datatypes - Discussion Page For Q.2736 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Final and Datatypes > Questions and Answers

Q: Class Test1{
Public static void main(String args[]){
Integer i1=10;
Integer i2=10;
If(i1==i2){
System.out.println(“ same”); }
Else{
System.out.println(“not same”) ; }
If(i1.equals(i2)){
System.out.println(“meaning fully equal”) ;}
} }
A. same not same meaning fully equal B.
same meaning fully equal not same     
C. same meaning fully equal   D.
not same

Answer and Explanation

Answer:same meaning fully equal  

Explanation:
here i1 and i2 are not two different objects, i1 and i2 are just references and these two holds same value 10, == operator is used to check the reference is same or not and .equals is used to check content is same or not. Here both content and reference is same so ans is C

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved 2012-2015 SoftLucent.