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

Which is faster call by value or call by reference?

501


What do you mean by JVM?

590


What do you understand by overloading and overriding in java?

546


What is annotation in java?

576


Is finalize() similar to a destructor?

551






Is hashset ordered java?

590


How do you execute a thread in java?

505


What is null mean in java?

627


What is qualitative variable?

524


What is t type java?

626


What is a methodologist?

531


What is the do while loop syntax?

553


What is the difference between jvm and jre? What is an interface?

553


What are the different approaches to implement a function to generate a random number?

571


Explain the usage of this with constructors?

530