Will the following code work.

will the following code work?--XYZ classpackage abc.def;public class XYZ {-}-PQR class--package mno;import abc.*;class PQR{ def.XYZ x = new def.XYZ(); //is this line ok!}
[282 byte] By [Sumit_Tyagia] at [2007-11-26 14:39:24]
# 1
Why aren't you testing it?
kajbja at 2007-7-8 8:20:35 > top of Java-index,Java Essentials,Java Programming...
# 2
...and you should probably read a tutorial on packages and imports. Kaj
kajbja at 2007-7-8 8:20:35 > top of Java-index,Java Essentials,Java Programming...
# 3
I was doing an excercise in a book(objective questions)The book says it is wrong, but according to me it should work.
Sumit_Tyagia at 2007-7-8 8:20:35 > top of Java-index,Java Essentials,Java Programming...
# 4
> I was doing an excercise in a book(objective> questions)> The book says it is wrong, but according to me it> should work.It doesn't work, that's why I told you to read about packages and imports.Kaj
kajbja at 2007-7-8 8:20:35 > top of Java-index,Java Essentials,Java Programming...
# 5

That means whenever we import packages, then only the classes in that package are resolved.

Package names are not resolved.

I took it as a file system, whenever we are in a directory, then all file names and subdirectory names are resolved (although contents of subdirectory are not resolved).

Thanks! I got my answer!

Sumit_Tyagia at 2007-7-8 8:20:35 > top of Java-index,Java Essentials,Java Programming...