Reading-notes

Arrays, Loops, Imports

Packages and Import :

-packages its the same of “directory”. A package is a single folder (directory) containing a group of related classes (.java files) and interfaces.

Package declaration :

-A package declaration, if used, must be the first thing in the file, and describes the folder in which it occurs.

Package declaration syntax:

Imports: three options:

if we take an example to see what the three options , we have JOptionPane class , this class located in the swing package which is located in the javax package.

The wildcard character (*) is used to specify that all classes with that package are available to your program:

Classes can be specified explicitly on import instead of using the wildcard character: -import javax.swing.JOptionPane; // Make a single class visible.

Alternately we can the fully qualified class name without an import like in this ex :

Common imports :

Java 5 added an import static option that allows static variables (typically constants) to be referenced without qualifying them with a class name.

A Guide to Java Loops :

for-loop :

while loop :

Do-While Loop :