Results 1 to 2 of 2
  1. #1
    saiganesh44 is offline Member
    Join Date
    Oct 2011
    Posts
    8
    Rep Power
    0

    Default Difference between String str1 = "hi"; and String str2 = new String("hi");

    Just wanna know the difference between String str1 = "hi"; and String str2 = new String("hi");

    and is there any specific reason to use the later one ??

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,017
    Rep Power
    10

    Default Re: Difference between String str1 = "hi"; and String str2 = new String("hi");

    Did you consult the String api? Java Platform SE 6
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 14
    Last Post: 04-08-2011, 07:01 PM
  2. Replies: 10
    Last Post: 12-07-2010, 01:29 PM
  3. string comparison with "=" and ".equal"
    By guavajuice in forum New To Java
    Replies: 9
    Last Post: 04-22-2010, 10:01 PM
  4. Replies: 0
    Last Post: 04-02-2009, 08:02 PM
  5. Replies: 1
    Last Post: 10-20-2008, 08:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •