Describe string intern() methodology



Describe string intern() methodology..

Answer / Md Aslam Khan

The String.intern() method returns the canonical (or unique) representation of a given string. Once created, this shared representation is cached and any subsequent calls to String.intern() for the same string will return the cached representation. This method is often used when performance is critical as it reduces memory usage by avoiding unnecessary duplicate strings.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

if arraylist size is increased from initial size what is the size of arraylist...suppose initial is 100 , if i add 101 element what is the size...

10 Answers  


If try block is successfully executed, Then Is Finally block executed?

1 Answers   PUCIT,


hi to all,i have a question on static block. i saved below as test.java class test extends a { static { System.out.println("test static"); } public static void main(String []dfs) { } } class a { static { System.out.println("a static"); } public static void main(String []asdf) { } } o/p as static test static but if i change base class as test class then class test { static { System.out.println("test static"); } public static void main(String []dfs) { } } class a extends test { static { System.out.println("a static"); } public static void main(String []asdf) { } } o/p test static explain me why "a static" wasn't print in second code when it is in derived class

1 Answers  


I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?

1 Answers  


What does bitwise or mean?

1 Answers  


What is static and a non-static inner class?

3 Answers  


How do you read and print a string in java?

1 Answers  


How to perform bubble sort in java?

1 Answers  


Can we write a class without main method in java?

1 Answers  


What are keywords give examples?

1 Answers  


What is null in java?

1 Answers  


What's the access scope of protected access specifier?

1 Answers  


Categories