1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
frosja888 [35]
3 years ago
8

Assume that the reference variable r refers to a serializable object. Write code that serializes the object to the file ObjectDa

ta.dat.
Computers and Technology
1 answer:
laiz [17]3 years ago
5 0

Answer:

FileOutputStream out = new FileOutputStream("ObjectData.dat");

ObjectOutputStream ostream = new ObjectOutputStream(out);

ostream.writeObject(r);

Explanation:

For object serialization, we can use the writeObject method of java.io.ObjectOutputStream class.

The complete code fragment is as follows:

import java.io.*;

class Demo{

      public static void main(String args[]){

             try{

                  r = <Reference to Object to be serialized> ;

                 FileOutputStream out = new FileOutputStream("ObjectData.dat");

                 ObjectOutputStream ostream = new ObjectOutputStream(out);

                  ostream.writeObject(r);

                 ostream.close();

            } catch(Exception e){

                   e.printStackTrace();

            }

      }

}

You might be interested in
Give the value of the zero flag, the carry flag, the signflag, and the overflow flag after each of the following instructions if
Vanyuwa [196]
The correct answer is A for this question
6 0
2 years ago
List the three control problems associated with competingprocesses and briefly define each.
hjlf

Answer and explanation :

the three control problems associated with competing process are

  • MUTUAL EXCLUSION : We know that some resources are shareable and some are not shareable. which means only one process can access the resource at a time this type of resources are called critical resources this code can be access at only one process at a time. the other process if required to access should not be allowed
  • DEADLOCK: this hold the process without complete for example suppose there are two resources R1 and R2 and two process P1 and P2 and P1 use R1 and P2 use R2 but after some time when P1 needs R2 but R2 is not available as it is used by P2 so the all process will be on hold
  • STARVATION : when priorities are given to the process as high priorities and low priorities. And high priorities process always competing  then low priorities process have to wait for very long time this is called starvation
3 0
3 years ago
Laura is using a rent to own store to purchase a computer valued at $1,000. She is paying $25 per week for 104 weeks(2 years). W
Naddik [55]
25*104 = 2600
she's paying 260% of the original price
8 0
3 years ago
A bookstore owner wants to allow customers to pay for books using their mobile phones. Which version of iOS will support the boo
swat32
Answer is iOS 9 & Apple Pay
7 0
3 years ago
Read 2 more answers
This is tech question related to mobile and PC.
love history [14]

I am guessing the bluetooth process is same as usb proccess. So when i transfered a video via usb and took out the usb (for apple phone), there <u>was</u> a file but when i clicked it it said that the phone isn't plugged in

4 0
3 years ago
Other questions:
  • Ben buys an Olympus E-PL2 from Sony which starts malfunctioning. When he opts for an exchange, the customer representative says
    11·1 answer
  • Which part of the os provides users and applications with an interface to manipulate files?
    8·1 answer
  • Your task is to improve a multi-threaded program that frequently writes small entries to a shared file by introducing a layer th
    7·1 answer
  • The exponential distribution is often used to model what in a queuing system?
    12·1 answer
  • You load an image file into a numpy array and look at its shape, which is (433, 650). What does this indicate?
    13·1 answer
  • WILL GIVE BRAINLIEST
    5·2 answers
  • Comparing tools made of stone, iron, and bronze: place them in the correct order from least to most durable.
    5·1 answer
  • The introduction of an academic paper must include a:
    12·2 answers
  • A program that organizes sequences of automated provisioning tasks. A. Application Packager B. Sequence Manager C. Sequence Logg
    14·1 answer
  • PLEASE ANSWER IN COMPLETE SENTENCES - JOURNALISM, 30 POINTS
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!