Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package csvreader;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.IOException;
- public class CSVReader {
- public static void main(String[] args) throws IOException
- {
- String[][] users = CSVReader("./users.csv");
- //String[][] item = CSVReader(*./item*);
- }
- public static String[][] CSVReader(String fileName) throws FileNotFoundException, IOException
- {
- String[][] maindata = new String[21][2];
- File file = new File(fileName);
- BufferedReader br = new BufferedReader(new FileReader(file));
- String st;
- int counter = 0;
- while ((st = br.readLine()) != null)
- {
- String[] data = st.split(",");
- maindata[counter] = data;
- counter++;
- }
- return maindata;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement