mohamed sanaullah wrote:
Anchit Herredia wrote:Do the package names have a dependency on the directory structure? How can I correct this error?
Yes they have a dependency.
You should have a nested directory inside practice1 as "self" where you can have a class with "package practice1.self"
Are you sure this is correct? I'm trying to use Eclipse to create this kind of package structure but it doesn't create. Both package1 and self get created at the same level of hierarchy.
Never mind about answering this. I got the answer. For some weird reason you need to create a new Folder in Eclipse. If you want to create nested packages just keep creating folders and then create the
Java files inside them.

I'm not sure why the behaviour is like this. Well, Thanks for your answers.
Also, here is further information to anyone wanting to read more on this:
http://www.webdeveloper.com/forum/showthread.php?t=71195
Eclipse makes it compulsory that the package structure should match the folder structure for the source. IntelliG doesn't have this restriction. And in both cases what really matters is that the compiled classes will have to follow the folder hierarchy according to their packages.