Computer Science, asked by js6189764, 20 days ago

WAP to read the content of file and display 'I' in place of 'E' while displaying the content of file all other characters should appear as it is.​

Answers

Answered by Anonymous
41

Replacing text - Java

Before we write the required program for this question, let's first take some hint for better understanding and know that what we need to do in this program and how to write the program. And also known about that what is Java and what is programing.

Java

Java is a high level programming language, it was developed by Sun Microsystems in the early early 1990s, it was designed by different platforms.

Programming

Programming means to create or develop a software which is called a program that contains the instructions to tell a computer what to do.

What we need to do

We would take a text first in that text we will replace 'I' in place of 'E'. Here's a syntax for replacing text, that is,

\tt{>>> \: str.replace('old','new)}

\rule{300}{1}

public class replace_text

{

⠀ public static void main(String[] args) {

⠀⠀⠀String str;

⠀⠀⠀str="Brainly is the best learning app.";

⠀⠀⠀System.out.println(str.replace('i','e'));

⠀ }

}

\rule{300}{1}

The Output

The output of the given program will be as follows:

>>> Braenly es the best learneng app.

\rule{300}{1}

Note: Do not copy-paste the exact c‎օde and run it, there are some white-space and no-space characters that will need to be removed before use, I've entered them for the sake of showing indentations in the c‎օde.

Similar questions