Results 1 to 3 of 3
- 02-18-2010, 05:11 PM #1
Member
- Join Date
- Jul 2009
- Location
- batticaloa, Sri Lanka
- Posts
- 30
- Rep Power
- 0
How to assign unique id to each object created from same class
hi all, i need a was to add unique id to each objects i have created form same class, for example i have a class called Customer and i have 2 fields,
1. name
2. id
this names is set when i create an object
Customer c1 = new Customer("Bunny");
Customer c2 = new Customer("Sunny");
now i need to have id set as follows:
c1 --> id = 1
c2 --> id = 2
how can i do that? please help me
- 02-18-2010, 05:21 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,605
- Blog Entries
- 7
- Rep Power
- 17
- 02-18-2010, 05:26 PM #3
Member
- Join Date
- Jul 2009
- Location
- batticaloa, Sri Lanka
- Posts
- 30
- Rep Power
- 0
Similar Threads
-
how to pass an arraylist from an object back to the parent object that it was created
By george_a in forum New To JavaReplies: 1Last Post: 03-04-2009, 06:14 PM -
Calling a method on original class from created class
By kpedersen in forum Advanced JavaReplies: 4Last Post: 08-20-2008, 12:25 AM -
Assign a keyboard key to a JButton.
By gszauer in forum AWT / SwingReplies: 1Last Post: 12-15-2007, 10:42 PM -
create a tree when a new class is created
By osval in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 08:58 PM -
Creating object of Type Object class
By venkatv in forum New To JavaReplies: 3Last Post: 07-17-2007, 03:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks