can't initialize a simple array, help

Joined
Sep 22, 2010
Messages
2
Reaction score
0
hey you all
i'm trying to initialize a databse, which is no more then a simple string array. i want to withdraw data from this array using another file.
here's my code:

class DataBase {

String[2] db;

void formatDataBase() {
for (i=0; i<=2; i++) {
db=null;
}
}

// void addBrand(String brand) {
// for (int i=1; i<=2; i++) {
// if (db==null) {db=brand;}
// }
// }

}

but i get the following errors:

3 errors
yotam@main computer:~/Documents/java/Car$ javac DataBase.java
DataBase.java:3: ']' expected
String[2] db;
^
DataBase.java:3: ';' expected
String[2] db;
^
DataBase.java:3: <identifier> expected
String[2] db;
^
3 errors
yotam@main computer:~/Documents/java/Car$

anyone? i'm lost, have no idea!:withstup:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top