Infosys Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

String object in java is immutable... i.e. Once created they cannot be changed. Any time an operation is performed on them, a new String object is created and the values are copied over.

StringBuffer is mutable. i.e, it can be changed.. so no copying is performed.

- Anonymous June 06, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

When another string is appended to the original string without using string buffer, new String object is always created.
If we use StringBuffer then same object of StringBuffer gets modified/appended.

- Jef December 14, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannoot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hance saves a lot of memory

- sushant February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- sushant February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The strings are immutable and when required to change the value or append the value the operation cannot be performed in the same string hence we need to take a new string resulting in waste of memory.............
but when we use string buffer we can perform any operation on that string like append etc hence it is very useful accurate and hence saves a lot of memory

- Sushant Pal February 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

StringBuffer saves memory, becouse any manipulation done to StringBuffer will not create a new memory ..insted the changes are done in the same memory..where as in String for each manipulation a new memory gets created in the Pool.
StringBuffer is variable in length in the sence it is mutable....!

- yogesh March 13, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More