Search code examples
javaeclipseimport

Where do we "import" the stuff from?


I am assuming that all of us are familiar with import java.util*; :)

I just wanted to know, do we physically store these classes on our computer, and if so, where? Or do we need some sort of internet connection.

I am assuming it has something to do with JAVA VM. But I honestly don't know for sure.

Why can't we just import java.*;


Solution

  • The class files are physically stored on your computer. For example, go look in %JRE directory%/lib/rt.jar. Look in the archive file and you will see java packages (you can find java.util.ArrayList.class for example).

    You can certainly import java.* but you will still need to qualify the paths for every package that comes after java.*