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 return null in java?
What causes memory leaks in java?
What are the uses of java?
Describe how to implement singleton design pattern in struts.
What are the different types of inner classes?
Can a class have a static inner class?
What java is used for?
Explain throw keyword in java?
What is a superclass?
What is a numeric digit?
Which method cannot be overridden in java?
How are multiple inheritances done in Java?
What are bind parameters?
What do you understand by synchronization?
What are the types of methodology?