Skip to main content

Array definition

1 reply [Last post]
booyeeka
Offline
Joined: 2007-03-13

I have multidimensional array, and it's defined in method private void btnOkActionPerformed ie.

private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {
....

String dbUpdate[][] = {
{"contact"},
{"contact_firstname", tfFirstName.getText(), "null"},
{"contact_lastname", tfLastname.getText(), "null"},
{"contact_companyname", tfCompanyName.getText(), "null"},
{"contact_description", taContactDescription.getText(), "null"}
};
...
}

How can I defined it, since I want to use it several times in this class? When I try to define it as

public class myClass extends JDialog {
....
static String dbUpdate[][] = null;
..

... "not a statement" error occured.

Can you help me with this? Thanx in advance!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jaypeevoss
Offline
Joined: 2004-02-20

[code]

static String dbUpdate[][] = null;

static {
dbUpdate = new String[][] {
{"contact"},
{"contact_firstname", tfFirstName.getText(), "null"},
{"contact_lastname", tfLastname.getText(), "null"},
{"contact_companyname", tfCompanyName.getText(), "null"},
{"contact_description", taContactDescription.getText(), "null"}
};
}
[/code]