Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39454
| From | Jeff Higgins <invalid@invalid.org> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Surprise! |
| Date | 2020-04-26 05:06 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <r83j0k$f1$1@dont-email.me> (permalink) |
| References | <Main.java-20190919202538@ram.dialup.fu-berlin.de> |
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