Java如何在控制台输出空格?
importjava.io.*;importjava.util.Scanner;publicclassg{/***@paramargs*@throwsIOExceptio...
import java.io.*;import java.util.Scanner;public class g { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stubSystem.out.print("请输入字符串:");Scanner input=new Scanner(System.in); String change=input.next();String regex="[\"]+";while(change!=""){change=change.replaceAll(regex, "\\\\\"");System.out.print(change);change=input.next();} }}
展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询