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
Define locale.
Can a class have a static inner class?
State some situations where exceptions may arise in java?
What is the size of int?
why we use merge option in hybernate pls give a ex snippet
How do you sort an array in java?
Explain method overloading?
What is the difference between the ">>" and " >>>" operators in java?
What are the basic interfaces of java collections framework?
What is stringwriter?
What does jre stand for?
what is a working thread? : Java thread
Which graphs are functions?
What is math exp in java?
What is the use of hashmap in java?