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 are the steps in the jdbc connection?
What do you know about the garbage collector in java?
Can extern variables be initialized?
What is Java Shutdown Hook?
what are different ways in which a thread can enter the waiting state? : Java thread
Difference between arraylist and vector.
Does java initialize arrays to zero?
Explain about the interpreter in java?
What is a substitution variable?
Which java ide is used the most?
Is null == null in java?
Why do you canvas?
what are Hostile Applets?
What are the two types of java programming?
why would you use a synchronized block vs. Synchronized method? : Java thread