English

Write down the syntax to perform the following task: To replace the word "old" with the word "new" in a given String st = "old is always old". - Computer Applications

Advertisements
Advertisements

Question

Write down the syntax to perform the following task:

To replace the word "old" with the word "new" in a given String st = "old is always old".

One Line Answer

Solution

String str = st.replace("old", "new");
shaalaa.com
  Is there an error in this question or solution?
Chapter 4: String Handling - EXERCISES [Page 287]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 4 String Handling
EXERCISES | Q III. 5. | Page 287
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×