How is the data saved after the power supply is cut off ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How is the data saved after the power supply is cut off ?

how is data saved in a pendrive after removing ?

4th Feb 2018, 1:23 PM
RaviKantKispotta Kispotta
RaviKantKispotta Kispotta - avatar
1 Answer
+ 2
option #01, Use a UPS for uninterrupted power source, would be the very best idea option #02: You cannot save data after the power is cut off, since the contents of the program which is currently being executed are held inside the RAM (volatile memory) which will be erased once the power is disconnected. But, what you can do is you can program a thread to write the contents of the program to disk (make use of the java.io.Serializable interface to directly write the content/object ot disk), once you recover from the power cut you can reload the program's contents which you had saved using the thread, Good Luck
4th Feb 2018, 5:33 PM
Mohamed Nuzrath
Mohamed Nuzrath - avatar