Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: regarding String

  1. #1
    Member
    Join Date
    Oct 2013
    Location
    india
    Posts
    31
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default regarding String

    hi java fans


    my first question is:


    1)wheather object reference and hashcode are equal are not?

    my thinking and my surrounding people saying both are same

    but....
    in one situation its not satisfying above rule

    i am creating two strings like

    String s1=new String("ravikumar");
    String s2=new String("ravikumar");

    generally we know that that one is creating two new objects but if i get the hashcode i am getting same for both .But if i use like


    if(s1==s2) //here i am getting false


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    585
    My Mood
    Sleepy
    Thanks
    10
    Thanked 87 Times in 80 Posts

    Default Re: regarding String

    regarding String

Similar Threads

  1. Replies: 6
    Last Post: June 3rd, 2013, 04:57 AM
  2. Replies: 2
    Last Post: March 28th, 2013, 09:54 AM
  3. Replies: 1
    Last Post: April 19th, 2012, 02:46 AM
  4. [SOLVED] difference between String Concatenation and String -Buffer/Builder .append(<value>)
    By chronoz13 in forum Java Theory & Questions
    Replies: 5
    Last Post: September 3rd, 2011, 08:16 AM
  5. Replies: 3
    Last Post: June 14th, 2009, 09:31 PM

Tags for this Thread