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 / puneet
No, the strings are immutable; the value of s will be the
same but new object kava will get crated which wil have no
refrence. s will refer to the same object which is not
changed.
s=s.replace("",""); should have worked...otherways
Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
Explain about data types?
What is foreach loop in java?
Can we declare a class as static?
What are the advantages of packages in java?
What are the types of collections in java?
Can an interface have a constructor?
What is mean by exception?
What is arraylist e in java?
Write a code to show a static variable?
What methodology can be employed to locate substrings inside a string?
What is the difference between comparison done by equals method and == operator?
Write a method that will remove given character from the string?
Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.
Is string is a keyword in java?
What is difference between calling start() and run() method of thread?