我工作的一个Java代码:
import java.util.Scanner;
public class main
{
static Scanner console = new Scanner (System.in);
public static void main (String aurgs[]) {
System.out.print("Which function would you like to vist? L for Lottery, R for Random Math");
char lotto = 'l';
char rdm = 'b';
if (console.nextChar() = lotto) /**error is here*/ {
lottery();
}
}
public static void lottery (String aurgs[]) {
String announ = "Your lottery numbers for today are: ";
System.out.print(announ);
int [] numbers = {15, 68, 25, 66};
double lucky = 50.2;
for (int i: numbers )
System.out.print(i + "\n");
String announ2 = "Your lucky number is: ";
System.out.println(announ2 + lucky);
}
}
当我编译它,BlueJ的说:
无法找到符号-方法nextChar()
我不明白什么是错的。