File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes arrayList access to Object's instance variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "arrayList access to Object Watch "arrayList access to Object New topic

arrayList access to Object's instance variables

kavundamani senthil

Joined: Feb 28, 2008
Posts: 16
In the program below how can i access the fields bankName, accId from the object o ?

import java.util.*;
public class sorting {
String bankName ;
int accId;
public void addaccount(String bankName,int accId)
this.bankName = bankName;
this.accId = accId;
public static void main(String args[])
TreeSet t = new TreeSet();
sorting s = new sorting();
sorting s1 = new sorting();
Iterator it = t.iterator();
object o =;}
Paul Somnath
Ranch Hand

Joined: May 19, 2008
Posts: 177

Preparing for SCJP 6.0
I agree. Here's the link:
subject: arrayList access to Object's instance variables
It's not a secret anymore!