Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #5018
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!r35g2000prj.googlegroups.com!not-for-mail |
|---|---|
| From | Chad <cdalten@gmail.com> |
| Newsgroups | comp.lang.java.programmer, comp.lang.java.help |
| Subject | What's the difference between and instance and an object? |
| Date | Mon, 6 Jun 2011 09:08:01 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 38 |
| Message-ID | <5d84ac2b-e81b-4c40-b3e3-c7248f1d7298@r35g2000prj.googlegroups.com> (permalink) |
| NNTP-Posting-Host | 66.81.215.178 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1307376481 3259 127.0.0.1 (6 Jun 2011 16:08:01 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Mon, 6 Jun 2011 16:08:01 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | r35g2000prj.googlegroups.com; posting-host=66.81.215.178; posting-account=kTs1ygoAAACgG1TSoyECpovEyy-V6_8b |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | ARLUEHNKC |
| X-HTTP-UserAgent | Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2),gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5018 comp.lang.java.help:743 |
Cross-posted to 2 groups.
Show key headers only | View raw
Let's say I have the following...
public class Main {
public static void main(String[] args) {
MyStack stack = new MyStack();
System.out.println("Instance of Object: "
+ (stack instanceof Object));
System.out.println("Instance of MyStack: "
+ (stack instanceof MyStack));
}
}//end Main
class MyStack {
private int size = 0;
public int tripleIt(int newSize) {
size = newSize;
return 3 * size;
}
}
I get the following output when I run this code...
Instance of Object: true
Instance of MyStack: true
How can there be an instance of MyStack when I never made a
constructor for it? That is, I never create a MyStack object.
Chad
Back to comp.lang.java.programmer | Previous | Next — Next 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