| | |
Problem using serializable coding
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Feb 2007
Posts: 2
Reputation:
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
Java Syntax (Toggle Plain Text)
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
•
•
•
•
Java Syntax (Toggle Plain Text)
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.
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
![]() |
Similar Threads
- 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
Views: 940 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for Java
3d @param affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth byte c# chat class classes click client code color compare component corrupted database detection draw eclipse error event exception file fractal game givemetehcodez graphics gui guitesting helpwithhomework html ide image input integer j2me java java.xls javaprojects jmf jni jpanel julia keytool keyword linux list loop map method methods mobile netbeans newbie number object oracle pong print problem producer program programming project read recursion reflection replaysolutions rim scanner screen server set size sms socket sort sql string swing terminal test threads time transfer tree web windows






