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 / vikneswarank
String s="java";
s.repalce('j','k');
System.out.println(s);
output is: java
because String is immutable.we cannt change of string
content.suppose u have to write
s=s.repalce('j','k');
output is :kava
Is This Answer Correct ? | 24 Yes | 3 No |
Post New Answer View All Answers
What is an immutable class?
What is not thread safe?
What do you mean by scope of variable?
What is the method in java?
Can we modify the throws clause of the superclass method while overriding it in the subclass?
What is a variable in java?
Why is serialization required?
How do you do math powers in java?
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?
Write a factorial program using recursion in java?
Convert a BST into a DLL and DLL to BST in place.
Can singleton class be serialized?
Explain hashset and its features?
How to convert string to byte array and vice versa?
Which non-unicode letter characters may be used as the first character of an identifier?