hello,
# 2 MyOwnClass object (You will have to create MyOwnClass.java first)
* MyOwnClass class has name (String type) and age (int type) is
the requirement is create an class and add the class for example into
arrayList ??
I try
public class MyOwnClass {
private String name;
private int age;
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
///////////////////
ArrayList al = new ArrayList();
al.addAll(Arrays.asList(n));
al.add(new Integer(1));
al.add(obj);
System.out.print("The arrayList of al: ");
for (Iterator it = al.iterator(); it.hasNext(); ) {
Object element = it.next();
System.out.println(element);
}
I get mycollectionproject.myowncl...@10385c1
what is wrong???
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en