Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34469
| Path | csiph.com!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Why is it called "default constructor"? |
| Date | Sat, 4 Jun 2016 15:31:44 -0400 |
| Organization | Aioe.org NNTP Server |
| Lines | 35 |
| Message-ID | <nivab2$14b1$1@gioia.aioe.org> (permalink) |
| References | <default-constructor-20160604183650@ram.dialup.fu-berlin.de> <default-constructor-20160604185253@ram.dialup.fu-berlin.de> |
| NNTP-Posting-Host | 7SK6yTFfqwlIPNBLl3l7Qg.user.gioia.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| Xref | csiph.com comp.lang.java.programmer:34469 |
Show key headers only | View raw
On 6/4/2016 1:54 PM, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>> So, why is it called »default constructor«?
>
> We can read this in the JLS:
>
> |The declaration:
> |
> |public class Point {
> |int x, y;
> |}
> |
> |is equivalent to the declaration:
> |
> |public class Point {
> |int x, y;
> |public Point() { super(); }
> |}
> |
> |where the default constructor is public because the class
> |Point is public.
>
> So, it says that »public Point() { super(); }« is a »default
> constructor« in the second class declaration.
I am not sure that it does.
I read it as that the implicit default constructor is public because
the class is public.
Not saying that the equivalent is a default constructor but explaining
why the equivalent is public.
Arne
Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread
Re: Why is it called "default constructor"? Arne Vajhøj <arne@vajhoej.dk> - 2016-06-04 15:31 -0400
csiph-web