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 the use of set in java?

866


How can we create an immutable class in java?

828


How does finally block differ from finalize() method?

826


How do I know if java is installed?

793


What is the advantage of OOP in java?

903


What is the differences between c++ and java? Explain

826


how does the run() method in runnable work? : Java thread

716


How is garbage collection controlled?

938


Explain about serializable interface in java?

784


What are the types of relation?

817


Why do we need wrapper class?

761


What is a loop java?

821


What is the difference between the font and fontmetrics classes in java programming?

724


Can extern variables be initialized?

700


Can you have two constructors in java?

711