Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21020

Re: "Hello world!" without a public class?

From "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org>
Newsgroups comp.lang.java.programmer
References <public-20130106091348@ram.dialup.fu-berlin.de>
Subject Re: "Hello world!" without a public class?
Date 2013-01-06 13:09 +0000
Message-ID <-8CdnaTS2P6a5HTNnZ2dnUVZ8vOdnZ2d@bt.com> (permalink)

Show all headers | View raw


Stefan Ram wrote:

>  There is no »public« in front of »class« in Oracles Tutorial!
>
>  What should I teach in my classes?

I don't have a strong opinion on how the class should be declared, but I do 
think -- and very strongly -- that the Java entry-point convention is a massive 
kludge, highly non-representative of how any sane OO code would be written, and 
not at all an example to be followed.  As such, I think it would benefit your 
students if you made that very clear to them from the start (yes, there is a 
risk of confusion, but no student will be confused who wouldn't otherwise 
probably be mislead -- which is worse).

FWIW: the examples in the JLS3 all use an default access class to house the 
(specified to be required) public static void main(String args...) or public 
static void main(String[] args) entry-point.  The spec does not appear to care 
what access the class itself has (and there's no obvious reason -- technical or 
semantic -- why it should).  Does "private" work ?  If so then using that would 
be defensible.

    -- chris 

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: "Hello world!" without a public class? "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-01-06 13:09 +0000
  Re: "Hello world!" without a public class? "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> - 2013-01-06 05:19 -0800
    Re: "Hello world!" without a public class? "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> - 2013-01-06 05:28 -0800
      Re: "Hello world!" without a public class? lipska the kat <lipskathekat@yahoo.co.uk> - 2013-01-06 13:36 +0000
      Re: "Hello world!" without a public class? "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-01-06 13:44 +0000
        Re: "Hello world!" without a public class? Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 10:49 -0500
          Re: "Hello world!" without a public class? Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 11:45 -0500
          Re: "Hello world!" without a public class? Martin Gregorie <martin@address-in-sig.invalid> - 2013-01-06 19:44 +0000
            Re: "Hello world!" without a public class? Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 16:09 -0500
              Re: "Hello world!" without a public class? Martin Gregorie <martin@address-in-sig.invalid> - 2013-01-06 21:46 +0000
  Re: "Hello world!" without a public class? "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-01-06 14:02 +0000
  Re: "Hello world!" without a public class? "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-01-06 14:12 +0000
  Re: "Hello world!" without a public class? Arne Vajhøj <arne@vajhoej.dk> - 2013-01-06 10:42 -0500

csiph-web