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
Write a method called justFirstAndLast that takes a single String name and returns a new String that is only the first and last
NemiM [27]

Answer:

Answer is in the attached screenshot.

Explanation:

Using regex to split a given input string via whitespace, then returns the first and last element of the array.

6 0
2 years ago
Cathy connected a keyboard, mouse, and printer to her computer through a Bluetooth connection. What type of network has she crea
Zielflug [23.3K]

The answer to the given question is (B) PAN.

A PAN (personal area network) connection is <u>a network used for interconnecting devices centered on a person’s workspace</u>. Bluetooth is a type of wireless PAN. Bluetooth-based wireless PAN connection is also called a <em>piconet</em>. Other examples of PAN that is not wireless based include a USB drive.

4 0
2 years ago
Read 2 more answers
Mary has been locked out of her account after failing to correctly enter her password three times. As the system administrator,
Digiron [165]
Oh hey lol yea yea lol I got the money back to me put on the phone so you know
7 0
2 years ago
At which stage should James, a website designer, gather information about the website he wants to create, and at which stage sho
viva [34]
<h2>Answer: James should gather information in the <u><em>Learning</em></u> phase and begin the site’s coding in the <u><em>Development</em></u> phase.</h2>

8 0
2 years ago
The tuna marketers' task in the "tunathewonderfish.com" website and related campaign was to ________.
Wewaii [24]
The answer to this question is "to monitor all the elements of the marketing mix for a Oregon winery". This is the main task of the tuna marketer's task in the emailing or website which is very known s tunwonderfish.com and this compaign was exclusively related to the elements of mixing in a large Oregon winery but not including the production.
4 0
2 years ago
Other questions:
  • Represent decimal number 8620 in (a) BCD, (b) excess-3 code, (c)2421 code, and (d) as a binary number
    7·1 answer
  • . When you have multiple graphics positioned on a page, you can _______________ them so that they are a single graphic instead o
    9·1 answer
  • Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyram
    12·1 answer
  • In a ____________________ attack, the attacker sends a large number of connection or information requests to disrupt a target fr
    14·1 answer
  • The term Electronic Privacy Information Center (EPIC) refers to a form of the digital subscriber line technology, which enables
    6·1 answer
  • What types of messages flow across an SDN controller’s northbound and southbound APIs? Who is the recipient of these messages se
    15·1 answer
  • Nathan would like to save his PowerPoint presentation as a video that can be replayed easily on any device at full quality. Whic
    14·1 answer
  • Explain in two or three sentences why health science careers are among the fastest growing careers in
    9·1 answer
  • Prompt
    5·2 answers
  • A group of developers for a startup company store their source code and binary files on a shared open-source repository platform
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!