Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes package concept Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package concept" Watch "package concept" New topic

package concept

venkat bagavathi subramanian

Joined: Dec 21, 2003
Posts: 19
well its been a while since i wrote code.
i am facing some (maybe vv silly) problems.
i have an interface and an implementation class.
since i was trying out package concept, i put the two in 2 java files.
public interface sec {}
public class first implements sec
psvm(String args[])

when i try compiling, i get sec not found error.
i thought if no package statement is included, all files will fall in the same package!
pl clarify this doubt.
thanks in advanced.
Harsha Vardhan Madiraju

Joined: Dec 19, 2003
Posts: 24
hi venkat,
I think there is nothing wrong with ur code. ensure that u r saving the 2 files in same folder
venkat bagavathi subramanian

Joined: Dec 21, 2003
Posts: 19
hi Harsha,
the 2 files are in the same folder!!! .this is turning to be v v irritating as i want to write some rmi pgms, for which i need to pgm interface +impl class.
am i missing anything here.
Ram Mohan
Ranch Hand

Joined: Jan 19, 2004
Posts: 44
maybe you should first compile the file???

If quitters never win, and winners never cheat, who's the idiot that said: Quit while you're ahead?
Sadanand Murthy
Ranch Hand

Joined: Nov 26, 2003
Posts: 382
Ram Mohan is right. Since you are compiling them individually, the dependencies will not get compiled automatically. You must 1st compile the interface & then the implementing class. Or you can start using Ant.

Ever Existing, Ever Conscious, Ever-new Bliss
I agree. Here's the link:
subject: package concept
It's not a secret anymore!