Beware: I’m not trying to compare if the characters are equals. Because I know how to use the String.equals() method. This question is about String reference I was studying for the OCA exam when I started to learn about the class String and it properties as immutability, etc. According to what I read or may understand about String pool is
Tag: string-pool
Why String created using new operator creates string literal in string pool
My Question is what’s the use of creating string object in string pool as well as on Heap when we declare String as String a = new String(“abc”); What is the advantage ? And why not we create string in heap when we create string as String a = “abc”. Answer The java language was designed like that. Anything you