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 / prachi
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method replaceAll(String, String) in the type String is not applicable for the arguments (char, char)
will be thrown because in replaceAll(‘j’,’k’) : j & k are in single quote which defines as character not as string. For correct output first replace single quote with double quotes and second write s = s.replaceAll(“j”, “k”);
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is methods and methodology?
Is 0 true or false?
Which of the classes will have more memory allocated?
What is javac used for?
How do you override a private method in java?
Define locale.
What is the mapping mechanism used by java to identify IDL language?
What is the difference between numeric and integer?
why doesn't java run on all platforms?
What are peerless components in java programming?
What is a wrapper method?
Write a program to show whether a graph is a tree or not using adjacency matrix.
How will you print number in reverse (descending) order in BST.
Can an arraylist be empty?
What are the default and parameterized constructors?