Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9172713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:24:57+00:00 2026-06-17T16:24:57+00:00

The intern method returns the canonical form of the string, can it be different

  • 0

The intern method returns the canonical form of the string, can it be different or the same as the string itself. Is it helpful in boosting the performance or just removes uncertainty?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:24:59+00:00Added an answer on June 17, 2026 at 4:24 pm

    intern() improves performance by reducing the number of duplicate strings. This reduces memory consumption but more importantly improve use of the caches. (The caches being much smaller than you main memory)

    However, using it directly can have performance problems if you place too many string in this pool (not something a normal program would do, but you could write a program to do so) This is because it is expensive to add strings to the pool O(N) not O(log N) as you might assume and even more expensive to clean up. In java 7 the string literal pool was moved to the heap to reduce the impact of large String literal pools but I would still suggest you use it sparingly if at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I use String.intern() to improve performance as I can use == to compare
The Javadoc about String.intern() doesn't give much detail. (In a nutshell: It returns a
I tried to look at Java's String#intern() method, but it's public native String intern();
According to String#intern() , intern method is supposed to return the String from the
Is it a good practise to use String#intern() in equals method of the class.
How to get string intern method in Metro c#. if not found in windows
Possible Duplicate: When to use intern() When should we use intern method of String?
MSDN states that String.Intern retrieves the system's reference to the specified String and String.IsInterned
In c extensions to ruby, to call a method you can do rb_funcall(object, rb_intern(method
I have a method in JNI C/C++ which takes jstring and returns back jstring

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.