Help Please

Joined
Jul 17, 2006
Messages
2
Reaction score
0
Hey wats up guys, I have a text file that stores database of clients names and bank info, I entered the info into an array but dont kn0w how to run a query based on user input?? help please this is my code
Code:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.*;
import java.util.*;
 
 
public class WordReader {
public static void main( String[] args ) {
  String Bebe;
  
    PrintStream output = System.out;
    Scanner input = new Scanner(System.in);
// will store the words read from the file
List<String> wordList = new ArrayList<String>();
 
BufferedReader br = null;
try {
// attempt to open the words file
br = new BufferedReader( new FileReader( "a2.txt" ) );
 
String word;
 
// loop and read a line from the file as long as we dont get null
 
while( ( word = br.readLine() ) != null )
// add the read word to the wordList
wordList.add( word );
} catch( IOException e ) {
e.printStackTrace();
} finally {
try {
// attempt the close the file
br.close();
} catch( IOException ex ) {
ex.printStackTrace();
}
}
 
// initialize a new string array equal to the size of thewordList
 
String[] words = new String[ wordList.size() ];
 
// call the wordList's toArray method to and transfer itemsfrom
 
// wordList to our string array words
wordList.toArray( words );
 
 
 
// loop and display each word from the words array
for( int i = 0; i<words.length; i++)
{
 
output.println(words[i]);
 
}
 
 
 
}
}
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top