hello i need a help, if i have a text file that contains something like this:
account num name credit account type
1 sara 1000 current
2 jerry 5000 comercial

i wanna get out the number in the credit coloumn to add or subtract from it and i don't know how to do it i think we will use 2D array but i don't know how, i tried to use index of method but it only can get the line which contains the name i entered but i can't get the credit it self, plz help me

What you posted above doesn't really make sense. Make sure to clearly explain what you mean. On one hand, your thread title makes it seem like you are having trouble reading stuff in from the file. If that is the case, then why are you talking about indexOf()? indexOf() is not used to read from the file.

An example of how to read from a file which contains:

an integer on the first line
a sentence (String) on the second line

Scanner readFile = new Scanner(new FileInputStream("filename.txt"));
int firstInt= readFile.nextInt();
String secondLine = readFile.nextLine();

Obviously, I didn't just solve your problem for you, I gave you an example of how to do it. With that, you should be able to figure it out. If you aren't sure what methods to use (for example, how would you read in a decimal value such as 3.556?) then google "Java Scanner" and read the documentation for the Scanner class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.