i got a Cannot resolve symbol error. what i am trying to do is create a number of accounts(depending on user input) and do id verification. is it possible for me to get back the input tt i got in createacc and use it in check? [JAM -- added [CODE] and [/CODE] tags] [ April 17, 2004: Message edited by: Joel McNary ]
class Acc { //assume constructor etc is done Acc[] acct = new Acc[i]; public int createacc() { System.out.println("How many accounts?"); i = cs.readInt(); Acc[] acct = new Acc[i]; do u mean like this? i get an array index out of bounds error now(during run time), in: if(getid.compareTo(acct[j].id) == 0)
class Acc { Acc[] acct; public int createacc() { for (j=0;j<=count;j++) { acct[j].bal = (acct[j].bal)*1.5; } return i; } public int checkid(int i) { //error here //code omitted } } i dont know why, but i got this Return statement not initialised/assigned error on my code. can someone help?
hi tian, you took my statement literally, what I meant was to declare the acct globally and initialize the array in the create()..this way the visibility of the acct will be to all the methods in the class. earlier you declared and initialized within the create() method so you got cannot resolve symbol error. I am reproducing the code here with changes...just go through it.
Post by:autobot
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards