More specifically, this is what's in your constructor:The stack trace gives the precise line in your code that starts down the path to the exception. One you have that line number, work backwards in your code.
The code is nearly unreadable because of the lack of proper indentation. Also, class names should begin with a capital letter.
Bhathiya Pathirana
Greenhorn
Posts: 9
posted 10 years ago
@Henry Wong
i initialized queArray variable
this time i don't get any errors but it does not get filled up so when i retrieve it is EMPTY
Please UseAMeaningfulSubjectLine when posting. Explaining your question or remark briefly on the subject line allows us to know what we are getting into, and if we will be able to help.
Bhathiya Pathirana
Greenhorn
Posts: 9
posted 10 years ago
@Henry Wong Subject line is changed Thank for the info
Bhathiya Pathirana wrote:@Henry Wong
i initialized queArray variable
this time i don't get any errors but it does not get filled up so when i retrieve it is EMPTY
That's not the correct fix. The correct fix is to do it correctly in your constructor. With this change, the array size and the maxsize variable may be out of sync.
Bhathiya Pathirana wrote:This is functioning properly
Depends on what you mean by functioning properly. If one of the tasks to do is to initialize the queArray *instance* variable, then your constructor doesn't do that.
Bhathiya Pathirana wrote:i'm really sorry, it's just i'm a beginner but thank you very much for trying to help me out i get no error but when i try to retrieve, it is empty
Hi.
It's a similar error to your first one. You need to learn about the scope of instances of objects/variables.
Do you understand why that was wrong?
Can you see the conflict?
If I were you I would start with a simple example. You are using inheritance, a GUI, inner classes- all very advanced topics. Start off with a very simple example where you can enter your name and get it to return it back to you(System.out.print() will do fine!). After that get it to store a number of names and print them all back to you. Once you can do that you can start worrying about creating Person classes with name/email fields etc.
You mean that compiler error on line 11? But if you leave out the "private" on that line then your example is a good one of local variables shadowing / hiding instance fields.
You mean that compiler error on line 11? But if you leave out the "private" on that line then your example is a good one of local variables shadowing / hiding instance fields.
Once I turned off my PC last night I felt that I had made that error! Updated.
Bhathiya Pathirana
Greenhorn
Posts: 9
posted 10 years ago
Thank you very much for you all guys being so supportive and kind about me, can anyone please let me have some hints for where i should start learning from? course names or training materials, so i can start having a good foundation..
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop