有没有办法通过创建一个等于该字符的新字符串变量来解决这个问题
import java.util.Scanner;
public class mean_and_scary {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter Text:");
String text = scanner.nextLine();
char leftchar = scanner.next().charAt(0);
char rightchar = scanner.next().charAt(0);
char removechar = scanner.next().charAt(0);
int width = scanner.nextInt();
text = text.replace(removechar, ""); // at this point
text = text.toUpperCase();
System.out.println(text);
scanner.close();
}
}
繁星淼淼
紫衣仙女
小怪兽爱吃肉
相关分类