| Author |
equals n ==
|
usha prithvi
Ranch Hand
Joined: Jun 22, 2005
Posts: 31
|
|
hi, Please explain the difference between == n equal? n how it works in Strings? Thankz
|
 |
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
|
|
|
What's the value of n?
|
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
|
 |
usha prithvi
Ranch Hand
Joined: Jun 22, 2005
Posts: 31
|
|
|
I am sorry.Itz and. What is the difference between == and equals? how does it work in Strings? Thankz
|
 |
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
|
|
|
This is a very basic question so I'd better move it to our Java In General (Beginner) forum.
|
 |
Hentay Duke
Ranch Hand
Joined: Oct 27, 2004
Posts: 198
|
|
This is the simple answer. Someone else may give you a more in-depth answer.
|
 |
Steve Morrow
Ranch Hand
Joined: May 22, 2003
Posts: 657
|
|
Here's an excellent article that you should read: Comparison operators: equals() versus == Please make the extra effort to write out words such as "and". The extra keystrokes won't cost much in the way of time, and the enhanced clarity will be appreciated by those communicating on a forum with international readership.
|
 |
Srinivasa Raghavan
Ranch Hand
Joined: Sep 28, 2004
Posts: 1228
|
|
equals() is used to check whether two objects are meaningfully equal & == is used to check whether if two instances are equal. From K&B book :- [ When you really need to know if two references are identical, use ==. But when you need to know if the objects themselves (not the references) are equal, use the equals() method. ] For String & Wrapper classes this equals() method is Overrided, For your own class you need to override the equals if you want to check whether two objects are meaningfully equal.
|
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
|
 |
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
|
|
Originally posted by usha prithvi: I am sorry.Itz and. What is the difference between == and equals? how does it work in Strings? Thankz
I think the point of the question about "what is n?" means that you need to use proper English. "Itz" isn't a word either. We try to maintain a somewhat professional appearance around here. This is especially important when you ask questions if you really want us to take you seriously. Please avoid l33t and other chat-like abreviations. It usually detracts from the point that you want to make and might even prohibit us from understanding you altogether. Layne
|
Java API Documentation
The Java Tutorial
|
 |
 |
|
|
subject: equals n ==
|
|
|