ok, so the data file is simple looks like this: 1 user pass name bday the 1 is the amount of rows which is only one right now. Well with this code when I am trying to print out the log of the user it prints this login@33acf5f7
how do I fix this to print that it is log[0] and how do I make this code so I can end up printing things like log[0].getName or do I have that part right itll end up working?
public class Project {
public Scanner sc;
login[] log;
public int readData() {
sc = new Scanner(System.in);
try {
sc = new Scanner(new File("src/input.txt"));
} catch (Exception e) {
}
int rows = sc.nextInt();
int data = 4;
// Fill in data
log = new login[rows];
try {
for (int i = 0; i < 1; i++) {
for (int j = 0; i < data; j++) {
String user = sc.next();
String password = sc.next();
String name = sc.next();
String bday = sc.next();
log[j] = new login(rows, user, password, name, bday);
System.out.println(log[i].getName());
}
}
} catch (Exception e) {
System.out.println("ERROR HERE");
}
return 0;
}
public static void main(String[] args) {
Project proj = new Project();
proj.readData();
}
}
class login {
private char[] user, pass, name, bday;
private String getName;
public login(int i, String user, String pass, String name, String bday) {
this.user = user.toCharArray();
this.pass = pass.toCharArray();
this.name = name.toCharArray();
this.bday = bday.toCharArray();
}
public char[] getName() {
return this.name;
}
}