Question
How java uses the string and stringbuffer classes?

Answers

Java strings are immutable, which means after you create a String object, you cannot change that object's contents. The Java designers found that most of the time, programmers do not need to change a string after it is created. By making String objects immutable, Java can provide better error protection and more efficient handling of strings. However, in case you do need to change the String, you can use a class called StringBuffer as a temporary "scratchpad" which you use to make changes. In short, your programs can change the String objects you store within a Stringbuffer and later copy the buffer's contents back to the String object after your alterations are complete.
In short, you should use String objects for "frozen" character strings whose contents you don't expect to change. In contrast, you should use the StringBuffer class for strings you expect to change in content or size. Within your programs, you can take advantage of features from both classes because both provide methods to easily convert between the two.   Your Comment




More Software,Java Questions..
What is the inputsplit in map reduce software?

Can variables be used in Java without initialization?

What is the difference between java bean and enterprise java bean?

What is software configuration management?

How does the java database connectivity (jdbc) work?

What are the advantages of threads in java?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

What is object cloning in Java?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?



Search
Can you Answer!!
  • Q How do we manage concurrent request?
  • Q Describe the architecture of Linux operating system(b) What are text editors? Explain the features of vi editor.
  • Q A mixture of naphthalene and benzoic acid can be separated by-
  • Q Explain about Automatic type conversion in java?
  • Q Does Microsoft use MFC in their products? Which ones?
  • Q What is the East-West distance of India?
  • Q What is Server Side Include?
  • Q How a CRT monitor works?
  • Q When the Federal Court of India replaced by Supreme Court of India?
  • Q For Workers Compensation accidental injury to be compensable, the injury must occur in all the following, except; (A)During the period of time when an a employee was at work (B)At the employer's place of business or such other location as may have been designated by the employer. (C)While the employee was performing their job duties or something related to them when the injury took place (D)As a result of the employee's negligence
  • Q What are the key differences between AngularJS and jQuery?