Computer Science, asked by nimiaswi, 4 months ago

10
Write a
Program to Take in a String and Replace Every Blank Space with
Hyphen.​

Answers

Answered by eashankhasija
0

Answer:

import java.util.*;

public class xyz{

public static void main{

Scanner sc = new Scanner(System.in);

System.out.println("Enter your String");

String ab=sc.next();

String nm=ab.replace(' ','-');

System.out.println(nm);

}

}  

IF SINGLE INVERTED COMMA DO NOT WORK TRY USING DOUBLE INVERTED COMMA IN "STRING NM".

HOPE IT HELPS :-)

Similar questions