hi i hava a code that ask the user for input, name, age etc and i want to save to my text file? thank you very much! how can i save it to a string?
here is my code:
byte name[] = new byte[100];
int nr_read = 0;
System.out.println("What is your name?");
try {
nr_read = System.in.read(name);
System.out.write(name,0,nr_read);
}
catch (IOException e) {
System.out.print("I'm Sorry. I didn't catch your name.");
}
here is my code:
byte name[] = new byte[100];
int nr_read = 0;
System.out.println("What is your name?");
try {
nr_read = System.in.read(name);
System.out.write(name,0,nr_read);
}
catch (IOException e) {
System.out.print("I'm Sorry. I didn't catch your name.");
}