Examlex

Solved

Import Java.nio.file.*; Import Java.io.*;

question 26

Essay

import java.nio.file.*;
import java.io.*;
public class ReadEmployeeFile
{
public static void main(String[] args)
{
Path file =
Paths.get("C: \\Java\\Chapter.13\\Employees.txt");
String s = "";
try
{
InputStream input = new
BufferedInputStream(Files.newInputStream(file));
BufferedReader reader = new
BufferedReader(new InputStreamReader(input));
__________________________
while(s != null)
{
System.out.println(s);
____________________________
}
reader.close();
}
catch(Exception e)
{
System.out.println("Message: " + e);
}
}
}
The above code represents a program that reads an Employees text file. An InputStream is declared for the file, and a BufferedReader is created using the InputStream. In the blank lines provided, write a statement that will read the first line into the String. Likewise, in the while statement, write the statement to display the String and read a new line as long as the readLine() method does not return a null value.


Definitions:

Timely Resolution

The act of resolving issues or problems within an appropriate or expected time frame.

Discrimination Charges

Legal claims filed against individuals or organizations who are accused of unfair treatment based on race, sex, age, or other protected characteristics.

Comparable Worth

The concept that jobs of equal value to an organization should receive the same level of compensation, regardless of the job holder's gender or other demographics.

Employee Surveillance

The monitoring of employee activities and behaviours in the workplace using various methods and technologies.

Related Questions