Coding error .

Hello All  , I am a new learner in Java and trying to run this code .

import java.util.Scanner;



public class Employee {

    private String firstName;
    private String lastName;
    private double monthlySalary;

    public Employee(String firstName, String lastName, double monthlySalary) {
        this.firstName = firstName;
        this.lastName = lastName;

        this.monthlySalary = monthlySalary;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public double getMonthlySalary() {
        return monthlySalary;
    }

    public class EmployeeTest {

        public void main(String[] args) {
            Scanner input = new Scanner(System.in);

            System.out.print("Enter employee one's first name: ");
            String firstName = input.nextLine();
            System.out.print("Enter employee one's last name: ");
            String lastName = input.nextLine();
            System.out.print("Enter employee one's monthly salary: ");
            double monthlySalary = input.nextDouble();
            Employee employee1 = new Employee(firstName, lastName, monthlySalary);

            input.nextLine();

            System.out.printf("Employee one's name: %s, %s%n",
                    employee1.getLastName(), employee1.getFirstName());

        }
    }
}
getting this error[b][b]:Error: Could not find or load main class employee.Employee.
Please if anybody can clarify me on code as to why this is coming up ?
Flex TronDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
How are you trying to run it?

There is no declared package so it should be

java EmployeeTest

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Flex TronDeveloperAuthor Commented:
Yes, It was needed to be declared and then it worked
0
CEHJCommented:
:)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
NetBeans

From novice to tech pro — start learning today.