Code Robo
Virtual Service
Comparator
Tester
Converter
Utility
Java Code Complience
Validator
Formatter
EncoderDecoder



Java Interview Question And Answer
       Talk to EasyAssistant

Java Interview Question And Answer. Java interview question and answer related to core java. . .


Questions:

  • How do we compare two String objects?
We use equal() method of String class to compare two String objects. We must not use '==' operator to compare the string values of two String objects as its check the reference only- whether both are pointig to the same object or not.
String str1="ABC";
String str1="XYZ";
if(str1.equals(str2)){
System.out.println("Both are equals");
}




Please provide your feedback here
It has been explained in this video (https://youtu.be/bxkNb0GuELY). Please watch it.
 


User Comments:
Post Your Comment:
Name :
Email ( Optional*) :
Comments / Suggestion (* Required) It is required: :
: