嘿,我是 java 初学者,在第 11 行出现错误。我不确定为什么会出现此错误 这是代码
package practice;
import java.util.Scanner;
public class VariablesDemo {
int empid;
char gender;
float allowance;
double basicSalary;
Scanner src = new Scanner(System.in);
System.out.println("Enter the Employee id");
public void setEmployeeId(int empid)
{
System.out.println("Enter the Employee id");
this.empid= src.nextInt();
}
public void setEmployeeGender(char gender)
{
System.out.println("Enter the Employee gender");
String gender_type=src.next();
this.gender= gender_type.charAt(0);
}
public void setEmployeeAllowance(float allowance)
{
System.out.println("Enter the Employee allowance");
this.allowance= src.nextFloat();
}
public void setEmployeeBasicSalary(double basicSalary)
{
System.out.println("Enter the Employee basic Salary");
this.basicSalary= src.nextDouble();
}
}