5 Replies Latest reply: Feb 1, 2008 8:37 AM by 807603 RSS

    Difference between String s="string" and String s=new String("string")

      what happens in the background considering the two cases
      String s = "mystring";

      String s = new String("mystring");

      When I execute
      public class StringBuffer {
          public static void main(String[] args) {
              String s1 = "mystring";
              String s2 = new String("mystring");
      //both the statements prints same value