How can I insert any value from here:
package main;
import java.util.*;
public class main {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
int count=0;
boolean again=true;
signup sign = new signup();
count++;
while(again) {
System.out.println("Enter username: ");
sign.user[count]=scan.next();
System.out.println("Enter password: ");
sign.pass[count]=scan.next();
System.out.print("Sign up? [Y/N] : ");
String a = scan.next();
if (a.equals("Y")&&sign.user[count]!=null&&sign.pass[count]!=null) {
System.out.println("[1]Back to log-in\n[2]View Accounts");
int b = scan.nextInt();
switch (b) {
case 1:
login newlog = new login();
newlog.loginhere();
;
case 2:
accounts newaccs = new accounts();
newaccs.accountshere();
;
}
} else if(a.equals("Y")&&sign.user[count]!=null&&sign.pass[count]==null){
System.out.println("Please fill out a password field!");
again=true;
}
}
}
}
to here:
package login;
public class signup {
String [] user = new String [100];
String [] pass = new String [100];
public void username (String user[],String pass[]) {
this.user=user;
this.pass=pass;
}
public String[] re() {
return user;
}
public String[] res() {
return pass;
}
}
and then whenever I select sign up from my main method and select view accounts, I want all the stored value from my second class to be printed here in my third class:
package login;
public class accounts {
public void accountshere() {
signup sign = new signup();
System.out.println("Username\tPassword");
for(int i=0; i<=1;i++)
System.out.println(sign.user+"\t"+sign.pass);
}
}
I hope you guys can help me, I don't know what am I doing to be honest, and I know I'm messing up, I just want to learn new things in programming. Feel free to criticize my code and correct me in a good manner. And I hope you guys get the point of my problem. Thank you :)