Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39454
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Jeff Higgins <invalid@invalid.org> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Surprise! |
| Date | Sun, 26 Apr 2020 05:06:48 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 27 |
| Message-ID | <r83j0k$f1$1@dont-email.me> (permalink) |
| References | <Main.java-20190919202538@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sun, 26 Apr 2020 09:07:32 -0000 (UTC) |
| Injection-Info | reader02.eternal-september.org; posting-host="0eea71e433630220460493dbbdd37833"; logging-data="481"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XHNeUnMVwR3LhqI5tSQb8ixONCfJT4H0=" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
| Cancel-Lock | sha1:/9TIU7SDpYpALnqtJ1n62r0rabY= |
| In-Reply-To | <Main.java-20190919202538@ram.dialup.fu-berlin.de> |
| Content-Language | en-US |
| Xref | csiph.com comp.lang.java.programmer:39454 |
Show key headers only | View raw
On 9/19/19 3:28 PM, Stefan Ram wrote:
> Write this:
>
> public final class A
> { public static void main( final java.lang.String[] args )
> { B.hello(); }}
>
> public final class B
> { public static void hello()
> { java.lang.System.out.println( "Hello!" ); }}
>
> and save it as "Main.java". Then call:
>
> java Main.java
>
> with a recent JDK. What you have there is a file named
> "Main.java" that does /not/ contain a class "Main", and
> it has /two/ public classes. Yet, the above command will
> happily print,
>
> Hello!
>
> .
>
>
https://docs.oracle.com/en/java/javase/14/docs/specs/man/java.html#using-source-file-mode-to-launch-single-file-source-code-programs
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Surprise! Jeff Higgins <invalid@invalid.org> - 2020-04-26 05:06 -0400
Re: Surprise! Martin Gregorie <martin@mydomain.invalid> - 2020-04-26 13:00 +0000
Re: Surprise! Joerg Meier <joergmmeier@arcor.de> - 2020-04-27 09:13 +0200
Re: Surprise! Martin Gregorie <martin@mydomain.invalid> - 2020-04-27 12:12 +0000
Re: Surprise! Arne Vajhøj <arne@vajhoej.dk> - 2020-04-27 08:34 -0400
Re: Surprise! Martin Gregorie <martin@mydomain.invalid> - 2020-04-27 13:52 +0000
Re: Surprise! Arne Vajhøj <arne@vajhoej.dk> - 2020-04-27 10:04 -0400
Re: Surprise! Arne Vajhøj <arne@vajhoej.dk> - 2020-04-27 10:09 -0400
Re: Surprise! Eric Douglas <e.d.programmer@gmail.com> - 2020-04-27 06:36 -0700
Re: Surprise! Arne Vajhøj <arne@vajhoej.dk> - 2020-04-27 09:46 -0400
csiph-web