Close
Close

Doubt in string declarations

   B Naveen Kumar , College

Hello sir, 

              I have a doubt regarding declaration of strings. May I know what's the difference between 

String s1 = "Welcome" ; ___(i) And

String s1 = new String("Welcome") ; ___(ii) 

Because when I compared two strings by the (i) format using == operator and equals() method it both  resulted in true. But when I compared both the strings using the (ii) format the == operator resulted in false whereas equals() method resulted true. Please explain me.

  • We can use == operators for reference comparison (address comparison) and . equals() method for content comparison. In simple words, == checks if both objects point to the same memory location whereas . equals() evaluates to the comparison of values in the objects.
    - Zupett1

Answers

  •    Wuzzy

    Speaking about the various ways of dating, I would like to note https://www.together2night.com/local-hookup.html where my brother met his boyfriend. It is difficult for homosexuals in any country because of the oppression of their choice, therefore they cannot meet openly. There are even separate chats for those who are shy or do not want to openly disclose their thoughts and fears. In general, the guy got caught cool, very cute. The site copes well with the task.



  •    Jordan80Evans

    You know, I’m looking for a partner now and I really want to know what imprimatur thing I need to use in searching? I hope somebody will share here some tips



  •    Christopher36

    I'm curious. Do girls who do fighting find a life partner easily? After all, not everyone would want to live with such a girl, because they would be afraid of her. Nevertheless, they are people just like everyone else.



  •    SamCox

    I think a lot of sportswomen are loved because they are famous. My acquaintance is dating such a girl and they are happy. He said that at https://www.lowkickmma.com/the-4-most-famous-couples-in-mma/, you can read an article about such dating. Perhaps these stories will interest you. Everyone has the right to find their happiness.



  •    Lucas74Jones

    There are many sources and you can find it on the social web. It's for sure, really. Anyway, you don't have to think that you are the right person because it is quite possible to find someone at any time in your life. Just as you need, I want to mention this sofia date as it will greatly help you to learn more about one dating resource. Visit this site and use it properly for yourself.



Ask Yours
Post Yours
Write your answer