Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
11th Edition
ISBN: 9780134671710
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 17.6, Problem 17.6.4CP
Program Plan Intro
ObjectInputStream/ObjectOuputStream:
The “ObjectInputStream/ObjectOuputStream” classes are used to read/ write serializable objects. It is used to perform I/O for objects in additions to primitive-type values and strings, “DataInputStream/DataOutputStream” can be replaced with the “ObjectInputStream / ObjectOuputStream”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
This is for Java. Please help. Thanks
True or False?
Instantiating an array of objects reserves room to store references only.
1. The append() method concatenates the string representation of any other type of data tothe end of the invoking StringBuffer object. It has several overloaded versions. Here are afew of its forms:StringBuffer append(String str)StringBuffer append(int num)StringBuffer append(Object obj)2. The result is appended to the current StringBuffer object.3. The buffer itself is returned by each version of append( ).4. This allows subsequent calls to be chained together, write java code for it
Chapter 17 Solutions
Introduction to Java Programming and Data Structures: Brief Version (11th Global Edition)
Ch. 17.2 - What is a text file and what is a binary file? Can...Ch. 17.2 - How do you read or write text data in Java? What...Ch. 17.3 - Prob. 17.3.1CPCh. 17.3 - How is a Java character represented in the memory,...Ch. 17.3 - If you write the string ABC to an ASCII text file,...Ch. 17.3 - If you write the string 100 to an ASCII text file,...Ch. 17.3 - What is the encoding scheme for representing a...Ch. 17.4 - Prob. 17.4.1CPCh. 17.4 - Why should you always close streams? How do you...Ch. 17.4 - Prob. 17.4.3CP
Ch. 17.4 - Does FileInputStream/Fi1eOutputStream introduce...Ch. 17.4 - What will happen if you attempt to create an input...Ch. 17.4 - How do you append data to an existing text file...Ch. 17.4 - Prob. 17.4.7CPCh. 17.4 - What is written to a file using writeByte(91) on a...Ch. 17.4 - How do you check the end of a file in an input...Ch. 17.4 - What is wrong in the following code? Import...Ch. 17.4 - Suppose you run the following program on Windows...Ch. 17.4 - After the following program is finished, how many...Ch. 17.4 - For each of the following statements on a...Ch. 17.4 - What are the advantages of using buffered streams?...Ch. 17.5 - How does the program check if a file already...Ch. 17.5 - How does the program detect the end of the file...Ch. 17.5 - How does the program count the number of bytes...Ch. 17.6 - Prob. 17.6.1CPCh. 17.6 - Prob. 17.6.2CPCh. 17.6 - Is it true that any instance of...Ch. 17.6 - Prob. 17.6.4CPCh. 17.6 - Prob. 17.6.5CPCh. 17.6 - What will happen when you attempt to run the...Ch. 17.7 - Can RandomAccessFi1e streams read and write a data...Ch. 17.7 - Create a RandomAccessFi1e stream for the file...Ch. 17.7 - What happens if the file test.dat does not exist...Ch. 17 - (Create a text file) Write a program to create a...Ch. 17 - (Create a binary data file) Write a program to...Ch. 17 - (Sum all the integers in a binary data file)...Ch. 17 - (Convert a text file into UTF) Write a program...Ch. 17 - Prob. 17.5PECh. 17 - Prob. 17.6PECh. 17 - Prob. 17.7PECh. 17 - (Update count) Suppose that you wish to track how...Ch. 17 - (Address book) Write a program that stores,...Ch. 17 - (Split files) Suppose you want to back up a huge...Ch. 17 - (Split files GUI) Rewrite Exercise 17.10 with a...Ch. 17 - Prob. 17.12PECh. 17 - (Combine files GUI) Rewrite Exercise 17.12 with a...Ch. 17 - (Encrypt files) Encode the file by adding 5 to...Ch. 17 - (Decrypt files) Suppose a file is encrypted using...Ch. 17 - (Frequency of characters) Write a program that...Ch. 17 - (BitOutputStream) Implement a class named...Ch. 17 - (View bits) Write the following method that...Ch. 17 - (View hex) Write a program that prompts the user...Ch. 17 - (Hex editor) Write a GUI application that lets the...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Take a close look at the C++ code in IntCollection.zip (Copy and Paste link to the external site http://fog.ccsf.edu/~mluttrel/cs110b/IntCollection.zip ) on my web site. The IntCollection class is a dynamic storage mechanism for storing integers. It could be used in place of an integer array. The following code creates an IntCollection object named ‘c’. It adds seven integers to ‘c’, then uses a for loop to display the seven integers: int main(){IntCollection c;c.add(45);c.add(-210);c.add(77);c.add(2);c.add(-21);c.add(42);c.add(7);for (int i = 0; i < c.getSize(); i++){ cout << c.get(i) << endl;}} For this assignment you will add a copy constructor, a destructor, and three overloaded operators to the IntCollection class. In the design diagram below, the black member functions represent code that has already been implemented. You will be implementing the green items. Each item that you will be adding to the class is described below the diagram. private:…arrow_forwardIn Java programming Write the code to print out an inventory report. Your code must read each inventory item from a file, populate the object, place the object in a linked list, and display the data by reading from the linked list after all items have been added. Use the inventory object name from Inventory inventory = new Inventory ( “inventory“); Assume you have opened a file and read a line into the inventory object Write the signature line for this method Write the line of code that will print the inventory object properties. Be sure to include a textual description of each property.arrow_forwardWrite a Java program that simulates a basic library delivery system. The user of the program will beable to add different types of items to library collection. In your program, as the main data structure,use the generic collection class ArrayList to store String references.Create three instances from ArrayList of String references. The first one will store the types, thesecond one will store the items, and the third one will store the owners of the items. The types areexactly the following: "Book", "DVD", "Magazine". The items and their owners will be read fromthe keyboard.Regarding the matching between an item and its owner, the location (index value) of an item in thelist of items will be the same with the location of its corresponding owner in the list of owners.As the next step, create the fourth instance from ArrayList of String references and call this list asitemsDeliveredByOwners. This last list will store String references to indicate the owners ofthe items (such as the…arrow_forward
- How do I extract data from a JSON Object? I am working on a project that requires me to extract the pop and name of a city. How would I set this up ? { "count": 1362963, "results": [ { "createdAt": "2019-12-09T21:04:56.736Z", "name": "la Massana", "adminCode": "04", "objectId": "JJfZWgGdZu", "population": 7211, "updatedAt": "2019-12-09T21:04:56.736Z" }, { "createdAt": "2019-12-09T21:04:56.736Z", "name": "les Escaldes", "adminCode": "08", "objectId": "PfCHLgNgxW", "population": 15853, "updatedAt": "2019-12-09T21:04:56.736Z" },arrow_forwardjson from url [{"id":"xxxxxxxxxxxxx","text":"Untitled folder","textCount":0}] How to get "id" by using ObjectMapper? Using JAVA: ObjectMapper mapper = new ObjectMapper();arrow_forwardYou must now write a method readVehicleData() in the ReservationSystem class, that reads this data, creates corresponding Vehicle objects and adds those objects to vehicleList. The name of the file that you read from should be selected using a file dialog box -- the name should not be passed to readVehicleData() as a parameter.arrow_forward
- What are the differences between ArrayList and Vector? Which collection class is good for manipulatingdata?arrow_forwardWrite a program that uses an ArrayList of parameter type Contact to store a database of contacts. The Contact class should store the contact's first and last name, phone number, and email address. Add appropriate accessor and mutator methods. Your database program should present a menu that allows the user add a contact, display all contacts, search for a specific contact and display it, or search for a specific contact and give the user the option to delete it. The searches should find any contact where an instance variable contains a target search string. For example, if "elmore" is the search target then any contact where the first name, last name, phone number, or email address contains "elmore" should be returned for display or deletion. Use a "for each" loop to iterate through the ArrayList.arrow_forwardNeed code in JAVA language Design and implement an application that reads a sequence of up to 25 pairs of names and postal (zip) codes for individuals. Store the data in an object of a class called “NameAndZip”, designed to store a first name (String), last name (String), and a postal code (int). Create a driver class called “NameAndZipList”. Assume that each line of input will contain two strings followed by an integer value. You will then create an object for each line read in and store that object in an array of NameAndZip objects. After the Names and Codes have been entered, print the list in an appropriate format to the screen using the toString method in the NameAndZip class. To test the program enter 3 names and codes. Test Run Enter infomation for [0] Enter the first name: Anthony Enter the last name: Williams Enter zip code: 08012 Enter infomation for [1] Enter the first name: Margo Enter the last name: Peters Enter zip code: 08080 Enter infomation for [2] Enter…arrow_forward
- How does a map tell us when an element is not found? A The map returns a null reference. B The map throws an exception. C The map returns an empty data object. D The map returns a value of zero.arrow_forwardIn java Browse Project Gutenberg (https://www.gutenberg.org/) for plain text versions of one or more works of literature of your choosing. Write a program that repeatedly searches a file for a target word or phrase.• Allow the user to supply the name of the file to search by means of a command-line argument; if the user does not supply a command line argument, ask for a file name interactively.• You may use either an array or an ArrayList to store each line in the file; but if you use an array, you’ll have to determine the array size (number of lines) before allocating the array. There are several ways to do this.• Report how many lines were read from the file.• Search for either individual words or phrases (Hint: use the .contains method, it’ll work for either a word or a phrase)• Show both the line number and the line itself for each line that contains the search target entered by the user (you may count the first line in the file as line 0).• If a search word is part of a larger…arrow_forwardplease begin with computeObjects([objects], func) using javascriptarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education