I use Eclipse IDE. This is a compiler error, so the error is:
Multiple markers at this line
- Cannot refer to an instance field columnNames while explicitly invoking a
constructor
- Cannot refer to an instance field rows while explicitly invoking a constructor
But i think that i've understand. Probably i can't use instance variables because the first line executed is super(....). So is needed that the fields to be static.
what is your opinion?
because when call to super is encountered inside constructor yet the instance is not created for that class....so thats is the reason you cant use any instance variable iinside super but since static variable does not exist with respect any instance so they can be used.
Sandeep is right. When a constructor is created, the following occurs (in order):
1) the call to super()
2) initialization of fields and execution of initializer blocks
3) the actual body of the constructor
Since columnNames and rows don't get initialized until step 2 they will have no value at step 1.
But why do you need to store the column names and data in the JTable? It's already stored in the model, and the JTable can simply retrieve it from it.
Post by:autobot
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
a bit of art, as a gift, the permaculture playing cards