嘿,我是在Java初学者和正在错误在第11行,我不知道为什么我收到此错误下面的代码的System.out.println错误
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();
}
}
有什么错误? – mre
完全删除第11行,你已经在'setEmployeeId'方法中使用它了。 – maksimov
这是错误的,这不仅是像你val这样的专家的地方,而且对于初学者也是,你有什么权利要求他解决他的问题! – anshulkatta