-
Array of objects
hi ,
could u tell me how can we create an array of objects
thanx
-
the same as you create any other array:
Student[] students = new Student[30];
See the Java Tutorial: http://java.sun.com/docs/books/tutor...OfObjects.html
-
thanks
but after creating array of objects of class student ,how i can store data to the
attributes of class and further retrieve them.
-
To retrieve an object contained in the array, you need to "get" that particular student object. You use the array index to refer to a particular object. You either know the storage index of the student, or you search for the particular student. Once you have that student object you can modify data members of the instance, or execute methods of that instance.
The usual method to retrieve is just a "getStudent" which returns an object of class Student. Usually you'll have some information about a particular student which can be used to uniquely identify the student - pass that info as the argument to your method. Can also do a "modifyStudent" method which can open up the student instance for your modification or addition of values.
Similar Threads
-
Replies: 6
Last Post: 04-17-2006, 10:21 PM
-
Replies: 1
Last Post: 02-06-2006, 12:48 AM
-
By dotnetforever in forum .NET
Replies: 2
Last Post: 02-15-2005, 07:16 PM
-
Replies: 2
Last Post: 04-17-2001, 04:03 AM
-
Replies: 1
Last Post: 03-08-2001, 10:50 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