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 is getkey () in java?

788


What is the diffrence between inner class and nested class?

817


Does substring create a new object?

752


How can you add and remove nodes in jtree?

808


What is private static class in java?

751


What do you understand by final value?

802


how to one war file class to another war file class?

1773


Can a boolean be null java?

741


What do you mean by flow of struts?

1011


What is the use of System class?

844


What is assembly language?

729


What are the elements of java?

784


What is meant by memory leak?

737


What is meant by distributed application? Why are we using that in our application?

757


What methodology can be employed to locate substrings inside a string?

723