gpt4 book ai didi

java - 我的扫描仪不断收到错误 "cannot find symbol"

转载 作者:行者123 更新时间:2023-12-01 11:44:37 26 4
gpt4 key购买 nike

我遇到了问题,因为当我尝试编译代码时,它说无法找到该扫描仪作为符号。

我可以做什么来解决这个问题?

public class Unit10
{
public static void main( String[] args )
{
scanner input = new scanner(System.in);
int numEmployees;
System.out.println( "How many employees do you wish to enter?" );
numEmployees = input.nextInt();
Employee[] employeeArray = new Employee[numEmployees];
for ( int i = 0; i < numEmployees; i++ )
{
Employee e1 = new Employee();
Name first = new Name();
Name last = new Name();
System.out.println( "Enter the first name of the employee" );
e1.setFirstName( input.nextLine() );
System.out.println( "Enter the last name of the employee" );
e1.setLastName( input.nextLine() );
}
}
}

最佳答案

Scanner是一个类,库中的每个类都以大写字母开头:

Scanner input = new Scanner(System.in);

关于java - 我的扫描仪不断收到错误 "cannot find symbol",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29261251/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com