好吧,我正在尝试编写这段代码,但我不断收到这个愚蠢的错误。我不知道我做错了什么,所以也许你们中的一位专家可以帮助我。
import java.util.*;
public class School
{
Random randQuest = new Random();
int userAnswer;
public void createQuestion()
{
int range = 10; // range of numbers in question
int num1 = randQuest.nextInt( range );
int num2 = randQuest.nextInt( range );
userAnswer = num1 * num2;
System.out.printf( "How much is %d times %d?\n",
num1, num2 );
}
// prompt comment
public String promComm( boolean answer )
{
if ( answer )
{
switch ( randQuest.nextInt( 1 ) )
{
case 0:
return( "Very Good!" );
}
switch ( randQuest.nextInt( 1 ) )
{
case 0:
return( "No. Please try again." );
}
}
}
}