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


Please Help Members By Posting Answers For Below Questions

What is a map in java?

557


What is an example of a constant variable?

540


Is 9 a prime number?

470


How does arraylist work in java?

536


How do you sort a string in alphabetical order in java?

537






Explain differences between collection api and stream api?

617


Do I need java for windows 10?

554


What is exception hierarchy in java?

593


What is r * in math?

554


describe method overloading

541


Can I learn java in 3 months?

546


In which order the iterator iterates over collection?

587


What’s the difference between constructors and other methods?

536


Hi i am creating desktop application in that i want calling to mobile number. i have java telephone api (JTAPI) but i dont understand how it configure & use plese help me

1368


Can I uninstall java?

555