12 Responses

Page 1 of 1
  1. Nadeem hussain
    April 24, 2013 at 4:33 am | | Reply

    i m getting identifier expected error at compile time,will u plsz help m to solve it

  2. Goutham D
    December 25, 2012 at 3:32 pm | | Reply

    Sir,

    What is the logic behind the swapping of 2 strings in java without using third variable????

    1. January 1, 2013 at 7:44 pm | | Reply

      It is to make coding simple. Internally it is done so.

  3. October 18, 2012 at 12:18 pm | | Reply

    Hi Sir,

    This is very nice article written by you.

    1. October 19, 2012 at 10:24 pm | | Reply

      Nice. Thank you.

  4. mohan
    October 4, 2012 at 4:21 pm | | Reply

    can u let me know difference between
    String s=”java”;
    String s1=new String(“java”);?

    1. October 14, 2012 at 6:07 pm | | Reply

      String s=”java”;

      The above statement is internally converted into the following. This shortcut of creating an object exists only for String class.

      String s1=new String(“java”);?

      1. Damodar
        November 11, 2013 at 12:13 pm | | Reply

        OK,But it is converted like this then why it give different results when we use == operator?

        1. November 11, 2013 at 1:17 pm | | Reply

          The logical == operator takes the literal reference from Java String pool. Because both string objects refer the same reference, the == returns true. But is not the case with equals() method.

  5. August 7, 2012 at 7:20 pm | | Reply

    System.out.println(“str1.compareTo(str3): ” + x);
    // the difference of 112-122 = 0

    Sir there is a mistake in this line “the difference of 112-122=0″ it should be 112-1121=0

    1. August 7, 2012 at 7:21 pm | | Reply

      sorry 112-112=0

  6. Dhiraj
    July 25, 2011 at 12:41 am | | Reply

    awesome article…..although i was clear about this topic but ur article offered a greater insight….:)

Leave a Reply