Packages_Objects1.htm
  • Object: : heap and reference (pointer): In Java classes are some kind of contours. containing variables and subroutines, which are represented collectively as an object to a given class.

    In the above codes, ec1 is an object, would be stored in HEAP ( special portion of memory, and memory location is tracked with some unique reference or pointer.
  • Constructor: Objects are created with "new" operator, which calls a subroutines called "constructor". The image below shows two constructor subroutines where the second one receives a string form a caller routine.
  • If you don't define constructor, system will provide default constructor, which will allocate memory and initialize instance variable.
Packages:
  • All the classes in Java are enveloped in a package.
  • default package is discouraged.
  • If an IDE like Eclipse or NetBeans tries to put a class into a package, you can delete the package name from the class-creation dialog to get it to use the default package instead.
    • An IDE normally consists of a source code editor, build automation tools and a debugger.
Package with an IDE:

Physical Location of Projects and Packages

 

An external class in the package is called :

Instantiation of an class and object creation:

The class name  is used to declare variables, this variable will hold some value. The values in this case are objects. Here an object is a collection of variables and subroutines