I have a question about using an Array. I read somewhere that by default java.lang.* is already imported in any classes thus there is no need to add it on top. I am using static method Array.getLength() but how come I need to import java.lang.reflect.Array; ? Can anyone please explain a reason for this?
java.lang.* importst only java.lang package.
java.lang.reflect is a completely different package.
They only share part of their name, but they are completely different,
they could be even stored in other jar files in different directories on the disk.
Think about package names like a directories on the disc, and about import clause like a 'dir' command
- dir /java/lang/* lists content only only of /java/lang, to list content of /java/lang/reflect
you must run another dir command.