Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package concept

 
venkat bagavathi subramanian
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe you should first compile the sec.java file???
 
Sadanand Murthy
Ranch Hand
Posts: 382
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic