I am having problems accessing the following array can some one please show me how to do this (newbie). I am trying to access the array from a class called AccGui and the array is in a class called AddAccount. The array is created as shown
then I created the following AddAccount to access the array from different classes
i then call this from AccGui with the following
as you can see i have tried different ways
and these are just a few but i have not had any luck. all comments welcome as i have lost the plot now, thx
Code:
private void makeAccount()
{
String accNum;
String accBal;
accBal=tBalance.getText();
accNum=tAccNum.getText();
int intAccNum = Integer.parseInt(accNum);
newAccountNum++;
float flAccBal= Float.parseFloat(accBal);
anAccount=new SavingsAccount(intAccNum, flAccBal, 0.05f);
sa[num] = anAccount;//i makes it italic so i am putting num
i++;
}
then I created the following AddAccount to access the array from different classes
Code:
public SavingsAccount[]getSavingsAccountArr(int num)
{
SavingsAccount[] tempList=new SavingsAccount[10];
for (int i=0;i<10;++i)
{
tempList[num] =sa[num];//should be i
}
return tempList;
i then call this from AccGui with the following
Code:
public float getSavingsAccountBal(int num)
{
float anynum;
SavingsAccount[] tempList=new SavingsAccount[10];
//for (int i=0;i<10;++i)
anynum=sa[num];
//getSavingsAccountArr();
//anynum= accounts.getSavingsAccountBal;
return anynum;
}
as you can see i have tried different ways
![[evil] [evil] [evil]](/data/assets/smilies/evil.gif)