permaculture playing cards*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package concept" Watch "package concept" New topic
Author

package concept

venkat bagavathi subramanian
Greenhorn

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.
say:
public interface sec {}
public class first implements sec
{
psvm(String args[])
{
System.out.println("hi");
}
}

when i try compiling first.java, 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
Greenhorn

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
Greenhorn

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.
thanks
venkat
Ram Mohan
Ranch Hand

Joined: Jan 19, 2004
Posts: 44
maybe you should first compile the sec.java 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
 
Consider Paul's rocket mass heater.
 
subject: package concept
 
Similar Threads
Exceptions visibility
SCEA and OMG
An Odd Problem
Interface Access
Why main method is public in Java