After the following program is finished, how many bytes are there in the file t.dat? Show the contents of each byte.
import java.io.*;
public class Test {
public static void main(String[] args) throws IOException {
try (DataOutputStream output = new DataOutputStream(
new FileOutputStream(“t.dat”)); ) {
output.writeInt(1234);
output.writeInt(5678);
output.close() ;
}
}
}
Want to see the full answer?
Check out a sample textbook solutionChapter 17 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Additional Engineering Textbook Solutions
Problem Solving with C++ (10th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Programming in C
Starting Out With Visual Basic (8th Edition)
Starting Out with Python (4th Edition)
- Insert the missing code in the following code fragment. This fragment is intended to read an input file. public static void main(String[] args) String inputFileName = "dataIn.txt"; File inputFile = new File(inputFileName); Scanner in = new Scanner(inputFile); Select one: Oa. throws FileNotFoundException b. inherits FileNotFoundException C. catches FileNotFoundException O d. extends FileNotFoundException Next pag A 1 ENGarrow_forwardPlease answer and write algorithmarrow_forwardjava pleasearrow_forward
- write java programarrow_forwardModify the code so that it writes the contents of String[] into a file named fileLoop1.txt CODE import java.util.Scanner; import java.io.*; public class Stringio { public static void main(String[] args) throws IOException { File loopfile = new File("fileLoop.txt"); Scanner getAll = new Scanner( loopfile ); String num; String[] items = new String[10]; int i = 0; while(getAll.hasNextLine()){ num = getAll.nextLine(); // square = num * num ; //System.out.println("The square of " + num + " is " + square); items[i] = num; System.out.println("items[i] is " + items[i]); i = i + 1; } getAll.close(); } }arrow_forwardJava program involves the use of Strings, characters and file I/O.arrow_forward
- Using Python: Write a program that inputs a text file then counts the unique words in the file. Output each unique word and the number of times it occurs in the input file. Remove any spaces and punctuation from the data and convert each word to lowercase. https://rose.instructure.com/courses/11779/files/1799063? verifier=PeDzy 7Z2p3NhCztKp6oaEJKkUa0z7vmWRyWQFchh&wrap=1 Sample Output: a 7 above 1 add 1 advanced 1 ago 1 all 1 altogether 1 and 6 any 1 are 3arrow_forwardUsing Python: Write a program that inputs a text file then counts the unique words in the file. Output each unique word and the number of times it occurs in the input file. Remove any spaces and punctuation from the data and convert each word to lowercase. https://rose.instructure.com/courses/11779/files/1799063?verifier=PeDzy7Z2p3NhCztKp6oaEJKkUa0z7vmWRyWQFchh&wrap=1 Sample Output: a 7 above 1 add 1 advanced 1 ago 1 all 1 altogether 1 and 6 any 1 are 3arrow_forwardWrite a program that reads a file containing two columns of floating-point numbers Prompt the user of the file name.Print the average of each column. javaarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT