Results 1 to 3 of 3
- 11-16-2010, 05:17 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 9
- Rep Power
- 0
A private static ArrayList hold an object and static getter ArrayList
A private static ArrayList named list that holds a list of Student objects.
ArrayList<student> list = new ArrayList<Student>();
A static getter named getList() that returns the ArrayList.
public static ArrayList<Student> getList() {
return list;
}
My arraylist and getlist are declare correctly ??
Why my output become like this "assign_student.Student@c17164, assign_student.Student@1fb8ee3"??Last edited by Louis; 11-16-2010 at 07:18 PM.
- 11-16-2010, 05:38 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
because your Student class does not override the toString method!
Writing toString Methods & Tech Days : Core Java Technologies Tech Tips
- 11-16-2010, 05:51 PM #3
Member
- Join Date
- Nov 2010
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
One big arraylist and static mess
By Crypts in forum New To JavaReplies: 12Last Post: 05-21-2010, 02:23 PM -
Arraylist errors with private fields
By DJRome in forum New To JavaReplies: 5Last Post: 03-02-2010, 12:00 PM -
private static setter method problem
By kyussy in forum New To JavaReplies: 7Last Post: 01-27-2010, 04:02 PM -
Error: Non-static method append(char) cannot be referenced from a static context
By paul in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 05:05 AM -
Error: non-static variable height cannot be referenced from a static context at line
By fernando in forum AWT / SwingReplies: 1Last Post: 08-01-2007, 09:25 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks