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

What are facelets templates?

585


What is the default value of local and global variables?

559


What is the platform?

522


How do you reverse a string in java?

572


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

527






What are methods of a class?

536


What is initial size of arraylist in java?

532


What’s meant by anonymous class?

594


Name container classes in java programming?

586


Which is easier .net or java?

637


Why we cannot override static method?

550


What are "class access modifiers" in Java?

604


What is constructor chaining and how is it achieved in java?

564


What is the difference between normal report & matrix report?

559


explain copyonwritearraylist and when do we use copyonwritearraylist?

530