answersLogoWhite

0

Substring method creates smaller string form bigger string , every time a new string is created but original character array buffer is used. so even if original string is 1G in size and substring is just 1K memory held by substring is 1G because of backed array. this can cause memory leak and prevent original string from garbage collection even if there is no direct reference.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Concat a string without using any inbuilt function in java?

Use "+". Example: String string = "does this answer " + "your question?";


How many bits does a Java char contain?

16 bits. Java char values (and Java String values) use Unicode.


How can find the length of a string in java without using fun?

Use length() method. Example: "java".length();


How can you convert byte to string in java?

To convert byte to String in java use the String(bytes, UTF-8); //example for one encoding type. You must know the special encoding that contains a variety of characters.


What are some example for string formatting in Java?

There are lots of examples of string formatting in Java. It can be difficult at times. Some of these examples are, but are not limited to; align, string, format, and JAVA.


How can someone convert string to int in Java?

To convert string to int in Java, the easiest way is to simply use the method Integer.parseInt(). For more information how to do this, refer to the integer class documents.


Java program to convert lowercase to uppercase?

You can use the toUpperCase() method on a String to convert any String to all uppercase.


How do you convert capital string to small in Java?

To convert a String object to lowercase in Java, use the toLowerCase() method. "HELLO".toLowerCase() returns a new String: "hello".


What is use of stringargs in main method?

Because Java takes only string values


What does it mean to have a string split in java?

To have a string split in Java means that a string array, containing substrings (can be delimited by elements of a specified string or Unicode character array), is returned.


What is the code required to convert an integer variable to a string variable in Java?

There are several different methods to convert an integer variable to a string variable in Java. For example, one can use the following code to convert an integer variable to a string variable: Integer.toString(number)


In computer terms what does the phrase 'java string replace' mean?

When referring to computer terms, the phrase "java string replace" means that a string in the line of code that Java uses, is being replaced, or needs to be replaced.