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 / vikneswarank

String s="java";
s.repalce('j','k');

System.out.println(s);

output is: java
because String is immutable.we cannt change of string
content.suppose u have to write
s=s.repalce('j','k');

output is :kava

Is This Answer Correct ?    24 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are different types of states exist for a thread?

543


What is difference between ++ I and I ++ in java?

522


Difference between object instantiation and construction ?

576


what is meant by encapsulation?

620


Is a class subclass of itself?

596






What is the disadvantage of synchronization?

549


Where and how can you use a private constructor?

528


How do you escape in java?

570


can any body body expalin best definitions & best real time exaples for opps concepts.

1831


What is io stream in java?

509


Explain thread in java?

656


What is your platform?s default character encoding and how to know this?

1747


What is the meaning of I ++ in java?

601


Is intellij better than eclipse?

533


What is the core java?

535