• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compilation units

 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
can any one explain what "compilation units " means?
from JLS
"The package java has subpackages awt, applet, io, lang, net, and util, but no compilation units."
Thanks,
Vanitha.
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my first encounter with the term. (in JLS, sect. 7.3) Sounds like a program, but I'm sure there is more meaning underlying the term.
CompilationUnit is the goal symbol (�2.1) for the syntactic grammar (�2.3) of Java programs. It is defined by the following
productions:
CompilationUnit:
PackageDeclarationopt ImportDeclarationsopt TypeDeclarationsopt
ImportDeclarations:
ImportDeclaration
ImportDeclarations ImportDeclaration
TypeDeclarations:
TypeDeclaration
TypeDeclarations TypeDeclaration
Types declared in different compilation units can depend on each other, circularly. A Java compiler must arrange to compile all
such types at the same time.
A compilation unit consists of three parts, each of which is optional:
1 A package declaration (�7.4), giving the fully qualified
name (�6.7) of the package to which the compilation unit
belongs
2 import declarations (�7.5) that allow types from other
packages to be referred to using their simple names
3 Type declarations (�7.6) of class and interface types
Every compilation unit automatically and implicitly imports every public type name declared in the predefined package
java.lang, so that the names of all those types are available as simple names, as described in �7.5.3.
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

JLS §7.2.1


... each of the .java files contains the source for a compilation unit ..


Compilation unit = source file
Hope that helps.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
Vanitha Sugumaran
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your replies Steven & Jane. JLS is kind of vague to understand sometimes. Now I got the point.
Vanitha.
 
reply
    Bookmark Topic Watch Topic
  • New Topic