-
programming fundamentals
Can anyone tell me what INSTANTIATE means in a java program, with a possible Example.
ty
gail
-
Here's another forum somebody already explained it in always check google first here's the link http://forums.dreamincode.net/showtopic13782.htm
-
Insantiate means 'to create an instance of'. In object oriented programming, objects are defined by classes, a class being a 'blueprint' of an object.
For example, think about chocolate chip cookies. You make them by following a recipe. The recipe defines what it is to 'be' a chocolate chip cookie. You can't use it to make oatmeal cookies or peanutbutter cookies, only chocolate chip cookies, because chocolate chip cookies have attributes that are unique to their type.
Instantiating a chocolate chip cookie means to create a single cookie by using the recipe (class). So, if I created a class called 'CCCookie', I would instantiate a 'CCCookie' with code like this:
CCCookie myCookie = new CCCookie();
I could make another one:
CCCookie yourCookie = new CCCookie();
I have now instantiated two of them...but they are totally independent of each other. If I were to execute the code
myCookie.eat();
It would not affect yourCookie in any way, because they are separate instances of the CCCookie class.
Hope this helps.
Similar Threads
-
By Kallahan in forum Java
Replies: 1
Last Post: 01-20-2003, 08:28 AM
-
By Novosoft in forum web.announcements
Replies: 0
Last Post: 02-14-2001, 03:50 AM
-
By Philip King in forum authorevents.appleman
Replies: 1
Last Post: 04-10-2000, 12:27 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks