我正在编写 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()
我不明白出了什么问题。