Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34469 > unrolled thread
| Started by | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| First post | 2016-06-04 15:31 -0400 |
| Last post | 2016-06-04 15:31 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Why is it called "default constructor"? Arne Vajhøj <arne@vajhoej.dk> - 2016-06-04 15:31 -0400
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2016-06-04 15:31 -0400 |
| Subject | Re: Why is it called "default constructor"? |
| Message-ID | <nivab2$14b1$1@gioia.aioe.org> |
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 top | Article view | comp.lang.java.programmer
csiph-web