Q:

Write a Java program to replace all the ‘d’ characters with ‘f’ characters

0

Write a Java program to replace all the ‘d’ characters with ‘f’ characters

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..

public class Javaexcercise {
 
   public static void main(String[] args)
    {
        String str = "TECHSTUDY - The Complete Debugging Solution";
 
        // Replace all the 'd' characters with 'f' characters.
        String new_str = str.replace('T', 'Y');
 
        // Display the strings for comparison.
        System.out.println("Original string: " + str);
        System.out.println("New String: " + new_str);
    }
}

Result:

Original string: TECHSTUDY - The Complete Debugging Solution

New String: YECHSYUDY - Yhe Complete Debugging Solution

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a java program to get the length of a given ... >>
<< Write a Java program to get a substring of a given...