Thursday, April 19, 2012

String literals vs String Object in Java

In java String can be created in 2 ways given below




  1. String foo="Test";

  2. String fooobj=new String("Test");



Everywhere it is mentioned about difference between these 2 ways of creating String. I want to know more about What are appropriate scenario's ,
where we should go for



  String foo="Test";


And when to go for



 String fooobj=new String("Test");  ?




No comments:

Post a Comment