grep said:

> > > sometimes i like java for one very simple reason, one class
> > > per file ..... 

I countered :

> > Huh?  You don't do much Java programming, do you Greg?

grep followed :

> i was led to believe that there you could only have one class per
> file in Java (excluding jar's of course)
> 
> Is this something that has changed since Java V1.1?

Yep.

Later versions of Java (1.2 onwards) introduce the concept of Inner
Classes:

 1. Member classes - Classes that are defined in the same file as the
    original class.  Come in two flavours static member classes and normal
    member classes.  Essentially the same as declaring them in a separate
    subdirectory, with a few quirks.  Very similar to defining multiple
    packages in Perl, but with the exception in Java you're forced to have
    a the same prefix to the class name.

 2. Local Classes - classes that can only be seen within the class/by
    referring via the parent class - defined inside the {} of the main
    class.  Can access private variables and suchlike.  Quite a nifty idea,
    but I always end up moving out my Local classes when I find I need to
    reuse the code....

 3. Anonymous classes - oft used to derive trivial subclasses of event
    handlers, anonymous subclasses are classes defined within statments 
    themselves, somewhat like a perl programmer would define an anonymous
    subroutine.  IMHO terrible syntax (very difficult to make readable code)
    and a bit of a hack since Java can't do closures and anonymous
    subroutines properly.

This is of course a very glib overview.  I suggest that those interested
parties have a look for themselves (Java may be mostly evil, but it's a
good idea to know what good/bad features it has.)  Java in a Nutshell 3rd
Edition, pg 117 might be a good place to start.

Later.

Mark.

-- 
print "\n",map{my$a="\n"if(length$_>6);' 'x(36-length($_)/2)."$_\n$a"} (
   Name  => 'Mark Fowler',        Title => 'Technology Developer'      ,
   Firm  => 'Profero Ltd',        Web   => 'http://www.profero.com/'   ,
   Email => '[EMAIL PROTECTED]',   Phone => '+44 (0) 20 7700 9960'      )





Reply via email to