How do you?

Hi,

how do you design a static method that takes two arguments, the name of the file and a reference to a char array.

The file should be opened, the contents of the array should be written to the file.

And then call it in the main.

i have something like this but it is not working.

publicclass Test{

}

Test(){

char[] a ={'a','b','c','d','e','f'};

}

static witeArray(char[] a, String file){

for (int i = 0 ; i < a.length ; i++ )

System.out.println(a[i] +" ");

}

the out put should look like this:

The characters read are:

a b c d e f

[1280 byte] By [asskoa] at [2007-11-27 8:38:36]
# 1
http://java.sun.com/docs/books/tutorial/essential/io/fileio.htmlCheck this out. And good luck!
petes1234a at 2007-7-12 20:36:20 > top of Java-index,Java Essentials,Java Programming...
# 2
I see several problems with your code. The char array you declare in your constructor is pointless. It's local to the constructor and it's not static, so the main method wouldn't be able to see it anyway. Your method also lacks a return type.
CaptainMorgan08a at 2007-7-12 20:36:20 > top of Java-index,Java Essentials,Java Programming...