我正在尝试编写一个程序来打印输入的用户字符串,并将元音替换为_。由于编译错误,我在程序无法打印的 if 部分遇到问题。
import java.util.Scanner;
public class mathpowers {
public static void main(String args[])
{
Scanner a = new Scanner (System.in);
System.out.print("Enter string: ");
String s = a.nextLine();
int count = 0;
for (char c : s.toCharArray())
{
if (c=='a' || c=='e' || c=='i' || c=='o' || c=='u') {
{
c = '_';
System.out.println (c[i]);
}
}
System.out.println("Your string has " + count + " upper case letters.");
}
}