answer.
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]
2 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]2 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
Which of the following can be managed using Active Directory Users and Computers snap-in?
Goryan [66]

Answer:

The answer is "Option b".

Explanation:

The active directory can manage the data with active directory customers but a snap-on machine. It is used in scrolling the list, as the earlier replies demonstrate. It will appear on the screen if there is no other startup software installed on a computer.  

This snap-on desktop is only a component, that allows its simultaneous use of different systems or devices on the very same system. It also turns the objects more or less into the pieces of the whole.

7 0
2 years ago
Sharon is thinking about opening a bakery. She knows she wants to set her own hours, reduce her stress and make a profit. But sh
hodyreva [135]
Please provide complete details.
4 0
2 years ago
In computing, a(n) _____ is an attack on an information system that takes advantage of a particular system vulnerability. Select
tensa zangetsu [6.8K]

Answer: d) Exploit

Explanation: Exploit is a type computer attack that successful when the computer system of an user is vulnerable and attacker can do the exploitation. This happens due to the weakness of the system, applications software, network etc.

Other given option are incorrect because exit door,glitch and bad are not any type of attack in the computer field that causes harm to the system.Thus the correct option is option(d).

4 0
2 years ago
Axel is finally documenting his work. What could he be writing?
allochka39001 [22]

Answer: maybe his wrtting ezam

Explanation:

7 0
2 years ago
35 points please help!
Ahat [919]

Answer:

Microsoft Poweroint

Explanation:

this software helps people to present their projects.

7 0
2 years ago
Other questions:
  • Which task can a company perform with intranets?
    9·2 answers
  • Float_abs - return bit-level equivalent of absolute value of f for * floating point argument f. * both the argument and result a
    8·1 answer
  • there are four stage of the product life cycle. during which of these stages do you think is the best time for a company to purc
    10·2 answers
  • PYTHON QUESTION
    15·1 answer
  • 14. Emelia is very concerned about safety and has conducted a study to determine how many bike helmets were replaced at each loc
    13·2 answers
  • The groups_per_user function receives a dictionary, which contains group names with the list of users. Users can belong to multi
    11·1 answer
  • 2 Name the package that contains scanner class?​
    10·1 answer
  • 1. Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call FindMax() twice in
    7·1 answer
  • A credit card company receives numerous phone calls throughout the day from customers reporting fraud and billing disputes. Most
    10·1 answer
  • A government agency is getting rid of older workstations. The agency will donate these workstations, along with other excess com
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!