good will see try to create a file where you will write the data of a client and the pet but I already do it in one method and the problem is that everything was stored in the same .txt and when entering several clients and pets are confused for a lot of information, so what I want to do is save a client and pet in different .txt which will have the date and time of the system so that when the client and pet enter several times several will be created. txt since each one will have a different name, the problem is that I get an error when creating the file
public class pruebahora {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
Date date = new Date();
DateFormat hourdateFormat = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
String historial = hourdateFormat.format(date);
FileOutputStream fs = new FileOutputStream(historial+".txt");
}
}
in that method it is supposed to create the .txt file that will have the time and date plus the extension .txt but this error marks me
Exception in thread "main" java.io.FileNotFoundException: 19:32:31 2018.txt (El nombre de archivo, el nombre de directorio o la sintaxis de la etiqueta del volumen no son correctos)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at pruebahora.main(pruebahora.java:14)
Then I would like you to help me see why I can not create the file with the system date and time