This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm a little bit confused. In C there is a difference between the declaration and the definition of a variable. In a (german) Java beginners book is stated that a variable declaration is always connected with storage allocation so there is no differentiation between declaration and definition.
In the glossary here are the two definitions differentiated. So is there a official differentiation (e.g. in the language specification) between declaration and definition or is a declaration in Java always a definition, i.e. connected with storage association.
I found no clear statement that there is no definition in Java and always a declaration.
To give the Sun glossary's definitions of the words:
declaration A statement that establishes an identifier and associates attributes with it, without necessarily reserving its storage (for data) or providing the implementation (for methods). See also definition.
definition A declaration that reserves storage (for data) or provides implementation (for methods). See also declaration.
The way I read the Sun glossary would be like this:
The wording of the second seems a bit strange, since the second line above is not a declaration - it's an object instantiation and variable assignment. In Java, you don't "reserve storage" (except maybe for arrays) - you create objects, which is often part of the same statement as the declaration, but isn't the same thing.
I don't recall anyone ever talking about variable "definition". It makes more sense for methods though, which can be declared in an abstract class or interface, but even then you talk about "implementation" rather than "definition".
You are doing better than me with those Sun glossary terms, Luigi Plinge; I find the difference hard to understand. Where did yo ufind that glossary; I went through the Java™ Language Specification index and couldn't find a heading for "definition".