DeloitteRole: Java DeveloperSeptember 2026
Interview question
Consider these Java String declarations:
```java
String a = "hi";
String b = "hi";
String c = "h";
String d = new String("hi");
```
How many distinct String objects are involved, and where are they stored in memory? Explain using the string constant pool and draw a memory diagram.