Wrox Programmer Forums
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Espanol section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 14th, 2005, 10:15 AM
Registered User
Join Date: Feb 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default String pooling?

What is String pooling in java?

Old November 3rd, 2006, 05:31 AM
Registered User
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

    When you create string literals jvm maintain all of them in pool known as String pooling.
for exapmle,

    String s1 = "Arul"; //case 1
    String s2 = "Arul"; //case 2

    In case 1, iteral s1 is created newly and kept in the pool. But in case 2, literal s2 refer the s1, it will not create new one instead.

      if(s1 == s2) System.out.println("equal"); //Prints equal.

      String n1 = new String("Arul");
      String n2 = new String("Arul");
      if(n1 == n2) System.out.println("equlal"); //No output.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pooling in IIS6 aliirfan84 ASP.NET 2.0 Professional 1 May 16th, 2007 07:14 AM
Connection Pooling nigam.anand Apache Tomcat 0 October 18th, 2006 08:39 AM
Connetion pooling problem wakeup BOOK: Professional Jakarta Struts 0 April 11th, 2005 09:03 AM
Connection pooling in VB vijayma VB How-To 0 March 18th, 2005 03:51 AM
Connection Pooling with Beans angrycat Apache Tomcat 4 September 16th, 2004 06:11 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.