I have an employee class see atthachement whic compiles fine and i have written some code called EmployeeAdd which uses the Employee Class which was deifining an Employee.

However my problem is when i am trying to import the Employee in to EmployeeAdd the error message i am getting is the following

error expected . at end of the line after import EmployeeAdd.java it just does not compile for some reason

This code was working fine before i am using jdk version 2.0

If anyone can help me plz

Thanks

Richard

import java.io.*;
import java.util.*;
import Employee;

The problem is with import Employee; --- you can't import classes from the same package without at least giving the package name/whatever.

Just remove import Employee; and you should be fine. As long as the classes are in the same directory/package, they're automatically available to one another. ;)

It is frowned upon to place classes in the "main" or "default" or "unnamed" package. And this is one of the problems that arise from that. Place each of these classes into a package, then import package.Employee and everything will be okay. Also, if they are in the same package, you don't need the import statement, at all.

import java.io.*;
import java.util.*;
import Employee;

The problem is with import Employee; --- you can't import classes from the same package without at least giving the package name/whatever.

Just remove import Employee; and you should be fine. As long as the classes are in the same directory/package, they're automatically available to one another. ;)

Part of the problem, is tht they are not in a package at all.

Thanks very much for helping me out with that query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.