Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: what file extension should I use when writing objects with ObjectOutputStream

The API shows .tmp, my text book uses .dat and I've seen .ser
Does it matter?

I'm writing an arraylist of objects

like image 892
Nicolas Avatar asked Dec 25 '22 09:12

Nicolas


2 Answers

Extensions doesn't matter. You could also use your name nicolas as extension too. Extensions are for OS to associate files to particular program.

like image 76
Prazzy Kumar Avatar answered Feb 09 '23 13:02

Prazzy Kumar


You can use any custom extensions. Extensions are meant to identify default program for the file. For example, abc.txt file should be opened with text programs. You can change extension of your video file to .txt and your computer will try to open it with text processing program. Hence, you can provide any extension unless you want to open file by particular program.

like image 29
SaurabhJinturkar Avatar answered Feb 09 '23 14:02

SaurabhJinturkar