Are You Feeling any difficulity while writing Core-Java Programs. Send those to me Here.
Showing posts with label String. Show all posts
Showing posts with label String. Show all posts

Monday, 24 June 2013

Diff b/w || String s = "hello" & String s = new String("hello") ||

The String Pool

Sun made an optimization that is rather confusing to many new Java programmers called the String Pool. It allows for Strings, which are one of the most used Objects to optimize themselves and save space. An important point to make is that the String Pool only applies to String literals, meaning their value was assigned, not constructed using a String constructor. Let me start off with an example: