Java packages tutorial part 2

Java packages 101 part 2, full name of class and import declaration.

One thing is to structure your project into packages and the other is to use classes from them.

When you put some class into package, you limit visibility of that class. Such class is now visible only in the same package.

If you want to use that class from another package, you must do one of two things:

You can use full name of class, which consists of all packages, in which class resides and name of the class,

Or you can import that class. Then you can access it without specifiing packages.

In Eclipse use Control Space to easily generate import.

Now I'll create a method, that will return a list of customer purchase orders.

comments powered by Disqus


Free online Java web application examples

Want to develop whole web applications which use database, security and more? See my github account, where are lot's of example projects: