| | |
Problem using serializable coding
![]() |
•
•
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
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor crashcourse database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows






