Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #5112

Re: What's the difference between and instance and an object?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Wed, 08 Jun 2011 11:33:36 -0500
Date Wed, 08 Jun 2011 09:33:35 -0700
From Patricia Shanahan <pats@acm.org>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version 1.0
Newsgroups comp.lang.java.programmer, comp.lang.java.help
Subject Re: What's the difference between and instance and an object?
References <5d84ac2b-e81b-4c40-b3e3-c7248f1d7298@r35g2000prj.googlegroups.com> <4decfdbc$0$17721$426a74cc@news.free.fr> <1a327de4-8451-4379-a75b-7cc2dab3fb5b@34g2000pru.googlegroups.com> <4ded05bb$0$17813$426a74cc@news.free.fr> <iso5qu$36v$2@speranza.aioe.org> <iso5vt$36v$3@speranza.aioe.org>
In-Reply-To <iso5vt$36v$3@speranza.aioe.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <2rWdnUf1RZ_9OXLQnZ2dnUVZ_ridnZ2d@earthlink.com> (permalink)
Lines 28
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 70.230.199.66
X-Trace sv3-79F3+TJtBJGk7Ra3vxkA7OSWEfLu+NtgmfpKTCUJEgXnVHrCKqAX4KgAJNynvY481JxzA+3TabcCRxV!0QNeh+XTIxs/adkWRy33k8m5YVIqUefNbFb7UAfJvYS5OPWwpxvmdtfnn9YlgYZE6O0ExcM3wiKm!UV7IZ1BhjVWXI403lWBUSKg8Xs2OqABT/IgM/aXKAve6Jw==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2423
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5112 comp.lang.java.help:758

Cross-posted to 2 groups.

Show key headers only | View raw


On 6/8/2011 8:54 AM, Abu Yahya wrote:
> On 6/8/2011 9:21 PM, Abu Yahya wrote:
>> On 6/6/2011 10:24 PM, Mayeul wrote:
>>> In other words, it cannot possibly build an instance of any other class,
>>> neither Object nor anything.
>>
>> Won't 'A' be an instanceOf Object?
>
> Err...I mean instanceof, with a lower-case 'o'.

There are two slightly different meanings of "X is an instance of Y".

1. X is an object whose class is Y. That is the meaning in which a
constructor can only return an instance of its own class. The expression
(new MyClass()), if it completes without exception or error, is always
an object whose class is MyClass.

2. X is an object whose class implements or extends Y. This is the
meaning that is tested by the "instanceof" operator. The expression

(x instanceof Y)

is true if x references an object whose class implements or extends Y.

(x instanceof Object) is true unless x is null.

Patricia

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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