declaration vs definition : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

declaration vs definition

In C++ you first declare the method headers defining the types of the parameters, but giving no details on how the method is computed. Then you later define the method procedure bodies. The idea is external code only looks at the declarations. External code does not need to be recompiled unless the definitions change. Everything in the declarations is repeated in the definitions and must be manually kept in sync.

Java has a more streamlined system. An ordinary Java method acts as both a declaration to inform callers of the parameters needed and a definition to elaborate how to compute the method. In addition, Java has abstract methods and their close cousins, interface methods, which act as pure declarations. When these template methods are implemented or overridden, they act like definitions.


This page is posted
on the web at:

http://mindprod.com/jgloss/declarationvsdefinition.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\declarationvsdefinition.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.143.214.133]
You are visitor number