Please correct the error, I don't know where I mistake. currently it says I've mistake at import.java.util.*; import.java.util.*; public class Employee { public static void main (String[] args) { DetailsEmployee deEmployee= new DetailsEmployee(); deEmployee.enterdetails(); NewEmployee neEmployee= new NewEmployee(); neEmployee.enteremployee(); } } class DetailsEmployee { DetailsEmployee() { System.out.println("Employee"); } void enterdetails() { Scanner s=new Scanner(System.in); System.out.println("Enter name:"); String name=s.nextLine(); System.out.println("Enter Id:"); int Id=s.nextInt(); System.out.println("Enter position:"); String position=s.nextLine(); System.out.println("Enter salary:"); int salary=s.nextInt(); } } class NewEmployee { NewEmployee() { System.out.println("New Employee is"); } void enteremployee() { Scanner s=new Scanner(System.in); System.out.println("Enter name:"); String name=s.nextLine(); System.out.println("Enter Id:"); int Id=s.nextInt(); System.out.println("Enter position:"); String position=s.nextLine(); System.out.println("Enter salary:"); int salary=s.nextInt(); } }
Please correct the error, I don't know where I mistake. currently it says I've mistake at import.java.util.*;
import.java.util.*;
public class Employee
{
public static void main (String[] args)
{
DetailsEmployee deEmployee= new DetailsEmployee();
deEmployee.enterdetails();
NewEmployee neEmployee= new NewEmployee();
neEmployee.enteremployee();
}
}
class DetailsEmployee
{
DetailsEmployee()
{
System.out.println("Employee");
}
void enterdetails()
{
Scanner s=new Scanner(System.in);
System.out.println("Enter name:");
String name=s.nextLine();
System.out.println("Enter Id:");
int Id=s.nextInt();
System.out.println("Enter position:");
String position=s.nextLine();
System.out.println("Enter salary:");
int salary=s.nextInt();
}
}
class NewEmployee
{
NewEmployee()
{
System.out.println("New Employee is");
}
void enteremployee()
{
Scanner s=new Scanner(System.in);
System.out.println("Enter name:");
String name=s.nextLine();
System.out.println("Enter Id:");
int Id=s.nextInt();
System.out.println("Enter position:");
String position=s.nextLine();
System.out.println("Enter salary:");
int salary=s.nextInt();
}
}
Step by step
Solved in 2 steps with 1 images