While coding in any programming language we always require some predefined types which we can use to write the code and every programming language provides these types in its way e.g. Java provides primitive types ( int, long, char float etc) and reference types (custom types like Object, String, Thread ). For string manipulation, Java provides a class java.lang.String which gives us a way to create string objects and provides different behaviors to operate on those objects e.g. replace(), length() String name = "Naresh"; System.out.print(name.length()); System.out.print(name.isEmpty()); Whenever we talk about String class in Java we say it is i mmutable in nature and all string literals are stored in String Constant Pool (SCP) . Prior to Java 7 String Constant Pool belongs to Permanent Generation area of heap which means Garbage Collector will not touch it in normal scenarios. But from Java 7 onwards string constant pool is not part of Perm Gen but live with o...
Naresh Joshi's blog for Java Language, Spring, Hibernate, Struts, Web Services, Micro Services, Design Patterns, Multi-threading, Collection XML, SQL.