Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Threaded View

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Accessing methods of an object inside in ArrayList

    I have created an arraylist in a class called bank below is a method i created in the bank class which is used to apply interest to all accounts in the array list by calling the method in the account class for every account in the arraylist but I am having trouble in getting the arraylist to apply the method to the accounts

     
    	public void Interest()
    	{
    	     // bank is the name of the arraylist and .addInterest() is a method in the account class
                 for (int i = 0; i< count; i++)
                   bank.get(i).addInterest();
    	}

    I have not dealt with arraylists very much so I am not too familiar with them, i assume that my syntax is incorrect because when i try to compile that result says "can't find symbol variable addInterest(). I can post more of the bank class or account class if needed. I appreciate any help or suggestions.
    Last edited by jmack; January 23rd, 2011 at 11:11 AM.


Similar Threads

  1. SAX Parser will not add object to arrayList
    By michaelz in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 1st, 2010, 02:59 PM
  2. How do i access methods from an arraylist?
    By kiph in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 7th, 2010, 07:52 AM
  3. [SOLVED] Passing arrayList inside class
    By KrisTheSavage in forum Collections and Generics
    Replies: 1
    Last Post: March 27th, 2010, 12:45 PM
  4. accessing elements in a 2d ArrayList
    By Flamespewer in forum Collections and Generics
    Replies: 2
    Last Post: March 8th, 2010, 06:11 PM
  5. Arraylist or Arraylist Object?
    By igniteflow in forum Collections and Generics
    Replies: 2
    Last Post: September 11th, 2009, 02:08 AM