String Constant Pool
Examine the below code snippet:
package com.test.test1;
public class StringPool {
public static void main(String[] args) {
String str3 = "Harry";
String str4 = "Harry";
System.out.println(str3);
System.out.println(str4);
}
}What will happen behind the scenes?


Lets validate:

Problem: Count the number of strings.

Last updated
Was this helpful?