If we create same string 100 times using new operator as shown below, how many objects will be created and if 100 objects will be created, it soulds like creating same string 100 times is not best and it looks JAVA inefficiently handling string object creation that is creating 100 objects for same string?
Please help me to understand. What is happening in reality?
String obj1 = new String("Hello");
String obj2 = new String("Hello");
String obj3 = new String("Hello");
................
................
String obj99 = new String("Hello");
String obj100 = new String("Hello");