Here, we are using two classes 1) FileOutputStream and 2) DataOutputStream,
FileOutputStream class is using to create an object by passing file name and DataOutputStream class is using to create an object to invoke writeBytes() method to write data in the file.
Consider the program:
Output