Computer Science, asked by shahchitra6073, 1 year ago

How to replace Digits into String using Java?

Answers

Answered by Anonymous
0

1.To convert an integer to string, we use the Integer.toString()function.

Ex:

int a=5;

String b=Integer.toString(a);

//now b="5"

System.out.println(b);//prints 5

2.To do the opposite, we use Integer.parseInt() function

Ex:

String a="5";

int b=Integer.parseInt(a);

//now b=5

System.out.println(b);//prints 5

Answered by Ᏸυէէєɾϝɭყ
1

Answer:

Java uses a replace function that returns characters :---

Syntax :- String stringname =String.replace('m' ,'n');

m= the charactera in string that is to be replaced.

n=the characters that are replaced by this character.

Example:--

String a="Bαnana";

String t=a.replace('a','e');

System.out.println(t);

OUTPUT :-- Benene

Similar questions