2

我不断收到此错误代码:

----jGRASP exec: javac -g RomanNumerals.java

RomanNumerals.java:56:无法访问的语句

违约:

1 个错误

----jGRASP楔:进程退出代码为1。 ----jGRASP:操作完成。

到目前为止,这是我的代码:

import java.util.Scanner;

public class RomanNumerals
{
   public static void main(String[] args)
   {
      int input;

      Scanner keyboard = new Scanner(System.in);

      System.out.print("Enter a number: ");
      input = keyboard.nextInt();

      switch (input)
      {
         case 1:
            System.out.println("I");
            break;
         case 2:
            System.out.println("II");
            break;
         case 3:
            System.out.println("III");
            break;
         case 4:
            System.out.println("IV");
            break;
         case 5:
            System.out.println("V");
            break;
         case 6:
            System.out.println("VI");
            break;
         case 7:
            System.out.println("VII");
            break;
         case 8:
            System.out.println("VIII");
            break;
         case 9:
            System.out.println("IX");
            break;
         case 10:
            System.out.println("X");
            break;
         defult:
            System.out.println("Please enter a number between 1 and 10. ");
     }
   }
}
4

1 回答 1

2

您输入了“默认:”,但它应该是“默认:”

尝试

default:
            System.out.println("Please enter a number between 1 and 10. ");
于 2013-09-12T03:59:19.850 回答