Really strugling to get my head round OOP.
Im trying to learn Java as well.
Im wanting to do a what i think is a small app. to create usernames from a csv file
If I have 2 files, one a csv file containing firstname , surname and the other is just a wordlist.txt file.
And my output is to a new csv file with firstinitial.surname, firstname,surname,password (from a word list)
I have this so far.
and then
So i can read in from one file and output to the output bar, i take it i will need to make new line an array so i can split the line up with stringtokenizer??
Im old school so not got my head around none linear programming as such.
what kinda classes or methods should i have,
IF you can help thank you so much in advance
Im trying to learn Java as well.
Im wanting to do a what i think is a small app. to create usernames from a csv file
If I have 2 files, one a csv file containing firstname , surname and the other is just a wordlist.txt file.
And my output is to a new csv file with firstinitial.surname, firstname,surname,password (from a word list)
I have this so far.
Code:
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try
{
Readfile read = new Readfile();
read.run();
}
// Report any IOExceptions which occur
catch (IOException IOEx)
{
System.out.println("Problems reading file " + IOEx);
}
}
}
and then
Code:
import java.io.*;
import java.util.*;
/**
**
*
*/
public class Readfile {
private FileReader fr;
private BufferedReader br;
private PrintWriter pw;
public void run() throws IOException
{
String nextLine;
Scanner sc = new Scanner(new File("export.csv"));
while (sc.hasNext())
{
nextLine = sc.nextLine();
System.out.println(nextLine);
}
sc.close();
}
So i can read in from one file and output to the output bar, i take it i will need to make new line an array so i can split the line up with stringtokenizer??
Im old school so not got my head around none linear programming as such.
what kinda classes or methods should i have,
IF you can help thank you so much in advance
Last edited: