Answer Posted / interviewall
If string a="aaaa"; and String b="bbbb";
we can compare them as
if(a.equals(b)) and get a boolean as a return type.
////////////////////////////////////////////////////////
We can also compare String as
a.compareTo("aaaa"); which gives 0 as output as they are
equal.
| Is This Answer Correct ? | 6 Yes | 3 No |
Post New Answer View All Answers
What is difference between local variable and global variable?
Can bool be null?
How dead lock situation occurs in java and how you can identify it?
What are the main uses of this keyword?
Is it possible to compare various strings with the help of == operator? What are the risks involved?
What is difference between == equals () and compareto () method?
What is mean by collections in java?
What is a flag value?
How does multithreading take place on a computer with a single cpu in java programming?
What’s a deadlock?
Why java strings are immutable in nature?
What was java originally called?
What is the difference between a choice and a list?
What is the program development process?
What 5 doubled?