我试图添加一些小动画,但只有当用户想要看到它们时。当我这样写时,我不断收到一个非法的表达式开始错误。为什么是这样?我是 Java 新手,到目前为止我玩得很开心,但我似乎找不到解决这个问题的方法。
我猜你不可能有public static void main( String[] args ) throws Exception
。
我不断收到以下错误:ureported exception InterruptedException; must be caught or declared to be thrown
if ( fxAnswer .equalsIgnoreCase("Yes") )
public static void main( String[] args ) throws Exception
{
int repeats = 5;
int steps_per_second = 10;
for ( int i=0; i<repeats*22 ; i++ )
{
if ( i%22 == 0 )
System.out.print(" ...SPECIAL EFFECTS!! \r");
else if ( i%22 == 1 )
System.out.print(" ...SPECIAL EFFECTS! \r");
else if ( i%22 == 2 )
System.out.print(" !...SPECIAL EFFECTS \r");
else if ( i%22 == 3 )
System.out.print(" !!...SPECIAL EFFECT \r");
else if ( i%22 == 4 )
System.out.print(" S!!...SPECIAL EFFEC \r");
else if ( i%22 == 5 )
System.out.print(" TS!!...SPECIAL EFFE \r");
else if ( i%22 == 6 )
System.out.print(" TS!!...SPECIAL EFFE \r");
else if ( i%22 == 7 )
System.out.print(" CTS!!...SPECIAL EFF \r");
else if ( i%22 == 8 )
System.out.print(" ECTS!!...SPECIAL EF \r");
else if ( i%22 == 9 )
System.out.print(" FECTS!!...SPECIAL EF \r");
else if ( i%22 == 10 )
System.out.print(" FECTS!!...SPECIAL E \r");
else if ( i%22 == 11 )
System.out.print(" FFECTS!!...SPECIAL \r");
else if ( i%22 == 12 )
System.out.print(" EFFECTS!!...SPECIAL \r");
else if ( i%22 == 13 )
System.out.print(" EFFECTS!!...SPECIA \r");
else if ( i%22 == 14 )
System.out.print(" L EFFECTS!!...SPECI \r");
else if ( i%22 == 15 )
System.out.print(" AL EFFECTS!!...SPEC \r");
else if ( i%22 == 16 )
System.out.print(" IAL EFFECTS!!...SPE \r");
else if ( i%22 == 17 )
System.out.print(" CIAL EFFECTS!!...SP \r");
else if ( i%22 == 18 )
System.out.print(" ECIAL EFFECTS!!...S \r");
else if ( i%22 == 19 )
System.out.print(" PECIAL EFFECTS!!... \r");
else if ( i%22 == 20 )
System.out.print(" SPECIAL EFFECTS!!.. \r");
else if ( i%22 == 21 )
System.out.print(" .SPECIAL EFFECTS!!. \r");
else if ( i%22 == 22 )
System.out.print(" ..SPECIAL EFFECTS!! \r");
else if ( i%22 == 23 )
System.out.print(" ...SPECIAL EFFECTS!! \r");
Thread.sleep(1000/ steps_per_second);
}
}