Java 我的do语句中的缩进获取错误

Java 我的do语句中的缩进获取错误,java,formatting,Java,Formatting,因此,do语句的缩进有问题。缩进会不会不同,因为我检查了所有的东西,通过它看起来很好 public void menu() { char option = '\0'; //This is intaillsing the character Scanner scanner = new Scanner(System.in); System.out.println("Welcome" + customerName); System.out.println("\n")

因此,
do
语句的缩进有问题。缩进会不会不同,因为我检查了所有的东西,通过它看起来很好

public void menu()
{
    char option = '\0'; //This is intaillsing the character 
    Scanner scanner = new Scanner(System.in);

    System.out.println("Welcome" + customerName);
    System.out.println("\n");


    //These will be all the option that will be dispalyed for the user to choose an option 
    System.out.println("A. Check Balance");
    System.out.println("B. Deposit");
    System.out.println("C. Withdraw");
    System.out.println("D. Previous transaction");
    System.out.println("E. Deposit using checks");
    System.out.println("F. Exit");

    do //This is saying to do all of these statement 
    {
        System.out.println("Enter an option");
        option = scanner.next().charAt(0);
        System.out.println("\n");

        switch(option)
        {
        case 'A':
            System.out.println("Balance = " + balance);
        }
    }//This indentation is showing me error 
}

Java在循环构造中没有语义上有意义的空格。您缺少循环构造的一半。特别是
while(条件)do while
循环的code>

do {
   // ...
} while (condition);

缩进在Java中毫无意义。你没有
while
在你的
do
之后,你需要使用do-while循环,这没有什么。自由形式语言的伟大之处在于-->这无关紧要:)它不是“重要的空格”。@chieftwoils这就是我说的,在语义上没有意义。事实上,我只是建议使用公共描述符。挑剔:在Java中,空格绝对重要,只是数量或类型无关紧要。您需要在标识符或关键字与其他标识符和关键字之间使用空格,有时还需要避免与run-in操作符混淆@ErwinBolwidt I故意添加了“循环内构造”。