I need some help, I am trying to find a way to save all data inputed by the user.
I would like to save it into a txt file or better yet a database.
I have posted my code below, thank you guys for any assitance you can provide :).
import java.util.*;
import javax.swing.*;
public class AoCGuildRegister {
Scanner sc = new Scanner(System.in);
String aocUsername = "";
String aocDiscord = "";
String aocFirstName = "";
int aocAge = 0;
String aocGender = "";
String aocFinal = "";
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); //System.in is a standard input stream
String aocUsername = JOptionPane.showInputDialog(null, "Enter your username");
if (aocUsername == null) {
JOptionPane.showMessageDialog(null, "You did not enter your username");
} else {
JOptionPane.showMessageDialog(null, "Your user name is : " + aocUsername);
}
boolean result = Boolean.parseBoolean(aocUsername);
String aocDiscord = JOptionPane.showInputDialog(null, "Enter your Discord username");
if (aocDiscord == null) {
JOptionPane.showMessageDialog(null, "You did not enter your a Discord username");
} else {
JOptionPane.showMessageDialog(null, "Your Discord username is : " + aocDiscord);
}
String aocFirstName = JOptionPane.showInputDialog(null, "Enter your firstname");
if (aocFirstName == null) {
JOptionPane.showMessageDialog(null, "You did not enter your firstname");
} else {
JOptionPane.showMessageDialog(null, "Your firstname is : " + aocFirstName);
}
String aocAge = JOptionPane.showInputDialog(null, "Enter your age");
if (aocAge == null) {
JOptionPane.showMessageDialog(null, "You did not enter your age");
} else {
JOptionPane.showMessageDialog(null, "You are " + aocAge + " years old");
}
String aocGender = JOptionPane.showInputDialog(null, "Enter your gender");
if (aocGender == null) {
JOptionPane.showMessageDialog(null, "You did not enter your gender");
} else {
JOptionPane.showMessageDialog(null, "You are : " + aocGender);
}
JOptionPane.showMessageDialog(null, "Thank you for signing up to the AoC Guild");
}