•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 397,816 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,622 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 627 | Replies: 4
![]() |
•
•
Join Date: Feb 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
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
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.
synchronized (theWorld) { System.out.println ("It's all mine..."); }
How many people have code in their Sigs?
How many people have code in their Sigs?
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.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
•
•
import java.io.*; import java.util.*; import Employee;
The problem is withimport Employee;--- you can't import classes from the same package without at least giving the package name/whatever.
Just removeimport 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.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
- Guess Number Game (Problem) (Java)
- Preview Upload Image Problem (PHP)
- Editing/Creating PHP Fields - Novice! Help? (PHP)
- i need tutorials on macromedia flash (Graphics and Multimedia)
Other Threads in the Java Forum
- Previous Thread: how to tokenize a long string by using another string
- Next Thread: Exception



Linear Mode