Article View: borland.public.jbuilder.java.language
Article #16961Re: class and istance
From: Paul Gifford
Date: Wed, 06 Jan 1999 00:00
Date: Wed, 06 Jan 1999 00:00
59 lines
1415 bytes
1415 bytes
Class and instace is like cars and my minivan. My van is an
instance of cars.
here's a little class:
------
class MyClass extends Object
{
public MyClass(int i)
{
myNum = i;
}
public int getNumber()
{
return myNum;
}
private myNum;
}
------
The class is just some code. It doesn't do anything until you
instantiate it:
------
(other code)
MyClass aTest = new MyClass(3);
int x = aTest.getNumber();
(etc etc)
-------------
Above, aTest is an instance of MyClass. You can't do
MyClass.getNumber; you have to operate on the instance of MyClass.
Hope this helps
p
On Mon, 28 Dec 1998 08:39:59 +0100, "ulisse agresti"
<uagresti@sigma.it> wrote:
>hi!
>from little that I take an interest of Java planning.
>I want to know which it is the difference between class and istance and, if
>is possible, see
>an example.
>
>thank you!!!!
>
>
>uagresti@sigma.it
>
>
Technical Details
Message-ID:
<36939ba6.5636302@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<767cmb$mbt5@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,f591ff6faa224237 X-Google-Attributes: gidf74b3,public From: paul.gifford@ibm.take.me.outta.here.net (Paul Gifford) Subject: Re: class and istance Date: 1999/01/06 Message-ID: <36939ba6.5636302@forums.inprise.com> X-Deja-AN: 429471304 References: <767cmb$mbt5@forums.borland.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language