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


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

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!news2.arglkargh.de!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news.space.net!news.osn.de!diablo2.news.osn.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail
NNTP-Posting-Date Sun, 06 Jan 2013 08:04:40 -0600
From "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org>
Newsgroups comp.lang.java.programmer
References <public-20130106091348@ram.dialup.fu-berlin.de> <-8CdnaTS2P6a5HTNnZ2dnUVZ8vOdnZ2d@bt.com> <startup-20130106143903@ram.dialup.fu-berlin.de>
Subject Re: "Hello world!" without a public class?
Date Sun, 6 Jan 2013 14:02:31 -0000
X-Priority 3
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.2900.5512
X-RFC2646 Format=Flowed; Original
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.5512
Message-ID <y72dncgdN-_lGXTNnZ2dnUVZ7tGdnZ2d@bt.com> (permalink)
Lines 48
X-Usenet-Provider http://www.giganews.com
X-AuthenticatedUsername NoAuthUser
X-Trace sv3-oMMps2fQmVWOmZPTUNv1FN2ZyAfTbgUA15g4tjoUlem+PRoffs9bzKQJWObNxzk5Yk49DxmB7yTldRY!fAmaINXhoN8S+bBiWohqHlwmEqsj88Dmif/fBvFknvP3UXPHrzqQY1m3a5I+wErGnKh2RUNVIP4=
X-Complaints-To abuse@btinternet.com
X-DMCA-Complaints-To abuse@btinternet.com
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 3106
Xref csiph.com comp.lang.java.programmer:21028

Show key headers only | View raw


Stefan Ram wrote:
> "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> writes:
> > students if you made that very clear to them from the start (yes, there
> > is a
>
>  I have no idea what you would prefer instead, but I just
>  made up this:
>
>  Rename »java.exe« (the JVM) to »new.exe« and modify the
>  interpretation of its command line arguments so that one can
>  write on the command line:
>
> new Main().start()

Or maybe (simpler, but less Java-like):

    javaNew.exe class-name method-name [arguments...]

Note that there's no need to mess with the JVM for these purposes, it only 
requires a special-purpose launcher program to replace java.exe.  The source to 
java.exe is provided, it's a simple JNI program, and is explicitly open for you 
to copy/modify/reuse without special licencing arrangements (at least that used 
to be true, haven't checked whether Oracle have changed anything).

But that might be overkill (however attractive).  Maybe simpler just to tell 
students always to write their entry-point in the form:

    class Xxx {
        public static void main(String args...)
        {
            new Yyy().doSomething();
        }
    }

(note that the entry-point class always contains main() and nothing else) and 
to treat that pattern as "magic".  Late in the course, after they've got a 
solid grounding in OO and (even later) you've talked about things like static 
methods (and why they are often a bad idea), you can explain what's going on 
with main().  With luck, by that point the students will be able to see that 
it's highly non-typical of Java code, and breaks several "rules", but (by then) 
you'll also be able to explain /why/ it's such a special case.

(All just ideas, of course, I am /not/ an educator, let alone an 
educationalist)

    -- chris 

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next 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