Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #5190
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!news.glorb.com!postnews.google.com!l2g2000prg.googlegroups.com!not-for-mail |
|---|---|
| From | Lewis Bloch <lewisbloch@google.com> |
| Newsgroups | comp.lang.java.programmer, comp.lang.java.help |
| Subject | Re: What's the difference between and instance and an object? |
| Date | Fri, 10 Jun 2011 11:05:16 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 37 |
| Message-ID | <be2152be-fdfc-4826-bf4c-0b9899d2818f@l2g2000prg.googlegroups.com> (permalink) |
| References | <5d84ac2b-e81b-4c40-b3e3-c7248f1d7298@r35g2000prj.googlegroups.com> <4decfdbc$0$17721$426a74cc@news.free.fr> <1a327de4-8451-4379-a75b-7cc2dab3fb5b@34g2000pru.googlegroups.com> |
| NNTP-Posting-Host | 127.6.6.6 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | posting.google.com 1307729117 28670 127.0.0.1 (10 Jun 2011 18:05:17 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Fri, 10 Jun 2011 18:05:17 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | l2g2000prg.googlegroups.com; posting-host=127.6.6.6; posting-account=6gJCewoAAAATGk_BiH9Eo-1pkyAWegc7 |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | ASELCHRU |
| X-HTTP-UserAgent | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30,gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5190 comp.lang.java.help:761 |
Cross-posted to 2 groups.
Show key headers only | View raw
On Jun 6, 9:33 am, Chad <cdal...@gmail.com> wrote: > On Jun 6, 9:18 am, Patrick <patr...@antispam.invalid> wrote: > > > Le 06/06/2011 18:08, Chad a écrit : > > > > How can there be an instance of MyStack when I never made a > > > constructor for it? That is, I never create a MyStack object. > > > You always have a constructor, even if implicit. > > You created an instance with new MyStack(). > > Maybe I'm acting like a dweeb about this, but according to the Java > Docs, when there is no explicit constructor, then the implict > constructor is Object. I think that is how they say it. So I figured That is not correct. I know of no place in any of the standard API's Javadocs that make any statement that could be understood that way. I don't even know where in the Javadocs you would hope to find such a statement. > that when I created instance of MyStack with 'new MyStack()', that the > only instance would be Object since I omitted the MyStack constructor. No. When you omit an explicit constructor, one *for that very type* is provided by the compiler, so the implicit constructor in your case is 'public MyStack()'. "All classes have at least one constructor. If a class does not explicitly declare any, the Java compiler automatically provides a no- argument constructor, called the default constructor." <http://download.oracle.com/javase/tutorial/java/javaOO/ objectcreation.html> -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
What's the difference between and instance and an object? Chad <cdalten@gmail.com> - 2011-06-06 09:08 -0700
Re: What's the difference between an instance and an object? Chad <cdalten@gmail.com> - 2011-06-06 09:16 -0700
Re: What's the difference between and instance and an object? Patrick <patrick@antispam.invalid> - 2011-06-06 18:18 +0200
Re: What's the difference between and instance and an object? Chad <cdalten@gmail.com> - 2011-06-06 09:33 -0700
Re: What's the difference between and instance and an object? Mayeul <mayeul.marguet@free.fr> - 2011-06-06 18:54 +0200
Re: What's the difference between and instance and an object? Chad <cdalten@gmail.com> - 2011-06-06 10:11 -0700
Re: What's the difference between and instance and an object? Abu Yahya <abu_yahya@invalid.com> - 2011-06-08 21:21 +0530
Re: What's the difference between and instance and an object? Abu Yahya <abu_yahya@invalid.com> - 2011-06-08 21:24 +0530
Re: What's the difference between and instance and an object? Patricia Shanahan <pats@acm.org> - 2011-06-08 09:33 -0700
Re: What's the difference between and instance and an object? Abu Yahya <abu_yahya@invalid.com> - 2011-06-08 22:07 +0530
Re: What's the difference between and instance and an object? Lewis Bloch <lewisbloch@google.com> - 2011-06-10 11:06 -0700
Re: What's the difference between and instance and an object? Abu Yahya <abu_yahya@invalid.com> - 2011-06-11 23:58 +0530
Re: What's the difference between and instance and an object? Lewis Bloch <lewisbloch@google.com> - 2011-06-10 11:05 -0700
csiph-web