Comment on Tutorial - equals( ) Versus == in Java By Mashoud
Comment Added by : sraban
Comment Added at : 2011-10-13 12:13:38
Comment on Tutorial : equals( ) Versus == in Java By Mashoud
Hi,it's really nice to see all the comments of the given topic equals() method and '==' .i would like to share the solution of question asked by Vijay.lets see
result for s1==s2 and s1.equals(s2) for following cases?
1)String s1="hello";
String s2="hello";
->Both equals() and "==" give TRUE
2)String s1 = new String("Hello");
String s2 = new String("Hello");
equals() will give TRUE but "==" will give FALSE
3)String s1="hello";
string s2=s1;
In this case also both will give TRUE bez both pointing to same location
Hope this will help u
View Tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Archived Comments
1. Hello all,
I need the codes for sen
View Tutorial By: Fionna at 2009-07-13 00:34:45
2. i know this example this is in mg.hill but i want
View Tutorial By: srikanta at 2009-11-18 00:06:57
3. The code is running successfully.........but , I m
View Tutorial By: Harshita at 2013-03-26 19:25:58
4. i am trying to create a handy and powerful barcode
View Tutorial By: incoming barcode scanner at 2014-06-23 04:23:42
5. pls send to me example about stacks
becaus
View Tutorial By: suliman at 2011-12-10 08:02:01
6. i m a student of Bahria university,Pakistan.and th
View Tutorial By: Rao Waseem at 2011-05-14 12:55:53
7. Please, send me a working JSP version ,i got error
View Tutorial By: Pang at 2008-01-11 00:01:52
8. hi!
please tell how i got the java comm api
View Tutorial By: suresh at 2010-08-22 03:29:06
9. the program does run thank you for that .....
View Tutorial By: VIKRAM at 2007-03-12 13:34:24
10. What is the difference between:
CMUsphinx4-
View Tutorial By: Netrika at 2011-11-26 19:55:07