<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<br>
<br>
<blockquote type="cite" cite="mid:CAGKkBkvGztuAamc6K+YsST90vbkJYD3B_YS=bcGT3yavCeHFiA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div> Indeed, I intend that there are no explicit
constructors or instance initializers here. (There can't
be constructors, because the class is unnamed!) </div>
</blockquote>
<div><br>
</div>
<div>Hmm, I was under the impression I could drop all my
`static`s while keeping the class signature if I wanted?
But, if I can and even then explicit constrs and initers are
banned, then indeed, at least one of my drawbacks is
invalid. I don't think it undercuts my overall case that
much.</div>
</div>
</div>
</blockquote>
<br>
Yes you can. Example:<br>
<br>
class InstanceMain implements Serializable { <br>
public InstanceMain() { }<br>
<br>
public void main() { ... }<br>
}<br>
<br>
and if you `java InstanceMain`, the launcher will do `new
InstanceMain().main()`. <br>
<br>
The two features -- no class header and instance main -- are
orthogonal. If you don't have a class header, you don't get
explicit constructors. If you use instance main, you must have a
no-arg constructor, which could be supplied explicitlly (if there is
a class header) or implicitly (whether or not there is a class
header.) <br>
<br>
<blockquote type="cite" cite="mid:CAGKkBkvGztuAamc6K+YsST90vbkJYD3B_YS=bcGT3yavCeHFiA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote"><br>
<div>One or more class annotations could appear
below package/imports?<br>
</div>
</div>
</div>
</blockquote>
<br>
No package statement (unnamed classes live in the unnamed
package), but imports are OK. </div>
</blockquote>
<div><br>
</div>
<div>I'm confused; what does any of this have to do with
package location? Isn't that orthogonal to everything we're
discussing?</div>
</div>
</div>
</blockquote>
<br>
There's a world where package is relevant here, but it seems pretty
esoteric. If you define a class with no name, the thing you want to
do with it is launch it directly. Seems like putting it in a
package makes little sense here. <br>
<br>
<br>
</body>
</html>