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 / pradeep rout

public class Test {

public static void main(String args[])
{

String s="java";
System.out.println("Before>>>>>>>"+s);
s=s.replaceAll("j", "k");
System.out.println("After>>>>>>>"+s);


}
}
----------------------Output---------
Before>>>>>>>java
After>>>>>>>kava

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the core java topics?

569


Name few java.lang classes introduced with java 8 ?

539


What is a databasemetadata?

557


What do you understand by copy constructor in java?

497


What is the difference between C++ and Java and your preferences?

618






In a class implementing an interface, can we change the value of any variable defined in the interface?

562


What one should take care of, while serializing the object?

485


Is string thread safe in java?

587


What is arraylist e in java?

522


Which is better 64 bit or 32 bit?

514


How do you compare objects in java?

505


How do you escape a string?

508


What are 3 boolean operators?

539


What is the constructor?

585


Explain different ways of creating a thread. Which one would you prefer and why?

579