I have a String s = java; What is the output when I say
s.replaceAll('j', 'k'); Also what is the value of s after
replacing?

Answer Posted / puneet

No, the strings are immutable; the value of s will be the
same but new object kava will get crated which wil have no
refrence. s will refer to the same object which is not
changed.
s=s.replace("",""); should have worked...otherways

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain covariant method overriding in java.

544


What is the difference between arraylist and hashset in java?

520


Why does java have different data types for integers and floating-point values?

535


Describe 2 different ways to concatenate two strings.

679


What is anti pattern in programming?

501






What is a final class in java?

545


What are the different types of multitasking?

658


How many types of design patterns are there?

529


What is the full form of jpeg?

523


What is a java object and java application?

576


Can you extend main method in java?

624


Differences between C and Java?

620


How java enabled high performance?

584


What is type inference in java8?

579


Define how destructors are defined in java?

588