Brainbench Java 2.0 Fundamentals, J2EE 1.4
http://www.brainbench.com/transcript.jsp?pid=8192792
John Pisci wrote:I added it, like you said but I'm still getting the same error.
I wasn't sure if I had to pass something into my dbConnect() method or not?
John Pisci wrote:I added it, like you said but I'm still getting the same error.
I wasn't sure if I had to pass something into my dbConnect() method or not?
John Pisci wrote:
I thought I had instantiated it with the "this.c = connect;"
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:
John Pisci wrote:
I thought I had instantiated it with the "this.c = connect;"
And how do you construct your instances? Are you sure you're not passing null to the constructor?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:No, I meant was: how do you create new btnSaveListeners? Because if you pass null to the constructor, then the reference stays null of course.
I'd create a new btnSaveListener by typing "btnSaveListener bsl = new btnSaveListener()", but that would still be null, right?
I'm not sure how I would add a value to 'c' without typing something like c = "1" or "test", which then gives me an incompatible types error.
Apologies for this being a simple error, but I just can't get my head around it!
Henry Wong wrote:
I'd create a new btnSaveListener by typing "btnSaveListener bsl = new btnSaveListener()", but that would still be null, right?
If you did this, then you still have compile errors... please don't run you code until you get rid of all of your compile errors.
Henry
Henry Wong wrote:
I'm not sure how I would add a value to 'c' without typing something like c = "1" or "test", which then gives me an incompatible types error.
Apologies for this being a simple error, but I just can't get my head around it!
The "connect" class type is part of your program. You wrote it (or got it from somewhere). If you can't figure out how to instantiate one, how do you expect us (who don't even know what it is) to tell you?
Henry
Yes I did write it.
I appreciate that what I asked was basic, but we all start somewhere- you were a beginner once too, so please, try not to patronise me.
Henry Wong wrote:
Your constructor takes two parameters. To construct a connect object you must use...
c = new connect(blah, blah);
Where the first blah is a reference to a btnSaveListener object, and the second blah is a reference to a gList object.
Henry
Henry Wong wrote:Your classes also seem to have a circular requirement... Your btnSaveListener class requires a connect object in order to instantiate it (with no other option to instantiate it). And your connect class requires a btnSaveListener object in order to instantiate it (with no other option to instantiate it).
In other words, both classes require that you have an instance of the other first, or you won't be able to create it.
Henry
Is that a spider in your hair? Here, threaten it with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|