Hi, I am not sure exactly what it is that you want from reading your post... I gather that you want to create an array whose length is the same as the value of a?? If so here is an example using your code.
If not then post something that more clearly explains what you are looking for.
import java.io.*;
public class FieldenTest {
public static void main(String[] args) {
FieldenTest test = new FieldenTest();
try {
String[] arrayToBeCreated = null;
int arraySize = test.Feldeintrag("c:\\t.txt", 2);
if(arraySize > 0) {
arrayToBeCreated = new String[arraySize];
System.out.println("FeldeinTrag returned:" + arraySize);
System.out.println("Array size: " + arrayToBeCreated.length);
} else {
System.out.println("FeldeinTrag returned size < 1");
}
} catch(Exception e) {
e.printStackTrace();
}
}
private int Feldeintrag(String fileName, int position) throws FileNotFoundException {
BufferedReader in = new BufferedReader(new FileReader(fileName));
String line = null;
int a = 0;
try {
for(int i = 0; i<= position; i++) {
line = in.readLine();
}
a = Integer.parseInt(line);
} catch (IOException e) {
System.out.println("Error in reading file");
}
System.out.println("the first number of the line is: " + a);
return a;
}
}