Question: CHALLENGE ACTIVITY 3 . 4 . 1 : File input. 5 2 2 5 6 2 3 5 7 8 1 9 4 quazid? Jump

CHALLENGE
ACTIVITY
3.4.1: File input.
5225623578194 quazid?
Jump to level 1
String fileName is assigned a file's name read from input. The file is opened as a FilelnputStream named peopleStream, and Scanner inFS may be used to read the file. Perform the following tasks:
Assign authorName with the first string read from the file.
Output the value of authorName followed by a newline.
Close the file.
Click here for example
\table[[AuthorDataReaderjava,in1.txt,in2.txt,in3.txt,in4.txt,in5.txt]]
import java.util.Scanner;
import java.io.FileInputStream;
import java.io.IOException;
public class AuthorDataReader {
public static void main(String args) throws IOException {
Scanner scnr = new Scanner(
System.in);
String fileName;
String authorName;
FileInputStream peopleStream = null;
Scanner inFS = null;
fileName = scnr. next();
peopleStream = new FileInputStream(fileName);
1
2
3
4
 CHALLENGE ACTIVITY 3.4.1: File input. 5225623578194 quazid? Jump to level 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!