Write a Java program to replace all the 'd' characters with 'f' characters.
Java Programming Language / String in java
3384Program:
public class Exercise { public static void main(String[] args) { String str = "The quick brown fox jumps over the lazy dog."; // Replace all the 'd' characters with 'f' characters. String new_str = str.replace('d', 'f'); // Display the strings for comparison. System.out.println("Original string: " + str); System.out.println("New String: " + new_str); } }
Output:
Original string: The quick brown fox jumps over the lazy dog. New String: The quick brown fox jumps over the lazy fog. Press any key to continue . . .
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS