String Constant Pool in Java
What is String Constant Pool in Java? It is a special memory area in Heap that contains references of string objects. There are two ways to create string object in Java. 1. Using string literal Example: String s = “java”; A string written inside double quotes is called string literal. Whenever we create string literal the JVM checks string constant pool. If the string is already present in pool then its reference is fetched. If the string is not present
Read more