MSK Institute • Shikohabad
Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Connecting serverPlease wait...
💻 Practical Labs🚀 Free Demo📜 Verified Certificates
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
In Java, String is an object representing a sequence of characters. Unlike strings in C++, Java Strings are strictly immutable: once created, their contents can never be changed.
To conserve heap memory, the JVM maintains a special cache in the Metaspace/Heap called the String Constant Pool:
If you create strings using double-quote literals, Java checks the pool first. If the string already exists, it reuses the existing reference!
new String()hashCode(), making them ideal keys for HashMap and HashSet.Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Test your understanding of this lesson with 1 questions. Each question has one correct answer.