• Post Reply Bookmark Topic Watch Topic
  • New Topic

String operations  RSS feed

 
Ravi Kishore
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
The following code snippet i got it from the site: clickhere



in that it is mentioned that by using String.intern(). the amount time taken to point to fixed literal is less than the time required to point a string to fixed literal without using String.intern()

but when i executed the above it is showing reverse.

can anyone tell me why it is happening in reverse condition?
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
remove the variables[i] = new String("hello"); statement from the intern loop as below:



The second loop as coded was doing all the work of the "new" loop PLUS the intern call. That is why it was longer.

Cheers,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!