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 difference between arraylist and list in java?
What is methods and methodology?
Is it safe to install java on my computer?
Is binary a low level language?
Write a program to search a number in the given list of numbers.
What is static and final keyword in java?
What is oop in java?
What is the difference between overriding and overloading in OOPS.
Explain java heap space and garbage collection?
What is jar?
What are some characteristics of interference class?
Is java owned by oracle?
What is the difference between jdk, jre, and jvm?
How does compareto work in java?
Is namespace same as package in java?