What happens if the file test.dat does not exist

Assignment Help JAVA Programming
Reference no: EM131586113

What happens if the file test.dat does not exist when you attempt to compile and run the following code?

import java.io.*;
class Test {
public static void main(String[ ] args) {
try {
BufferedReader infile = new BufferedReader(new FileReader("test.dat"));
String mytext = infile.readLine();
}
catch(IOException ex) {
System.out.println("IO exception");
}
}
}
The program compiles, but throws IOException because the file test.dat doesn't exist. The program displays IO exception.

The program does not compile because infile is not created correctly.

The program does not compile because readLine() is not implemented in BufferedReader.

The program compiles and runs fine, but nothing is displayed on the console.

 

 

Reference no: EM131586113

Questions Cloud

Optimizes patient care and minimizes cost : Suggest three (3) approaches to staffing for 24/7 coverage that optimizes patient care and minimizes cost. Provide support for your rationale.
Speculate on major reasons why certain countries have lagged : Speculate on the major reasons why certain countries have lagged behind other countries in economic development.
Discuss cloned child creates a huge field of moral dilemmas : Why is raising a cloned child creates a huge field of moral dilemmas that cannot truly be answered without actually cloning a human
Evaluate the warehousing facility project : Determine what discount rate (WACC) Vestor should use to evaluate the warehousing facility project. Assess whether Vestor should make the warehouse investment.
What happens if the file test.dat does not exist : What happens if the file test.dat does not exist when you attempt to compile and run the following code?
Review the case study of gumball machine : A gumball machine requests 25 cents and, in return, sends a colorful gumball down a chute into your waiting hands. The gumballs in this machine come in white.
Conduct a variety of meetings effectively : Does the meeting have a set communication designed with relevant information to advance the meeting? Please explain.
What is the total number of radio buttons : What is the total number of radio buttons and check boxes that can be selected at any time - with three radio buttons
Explore the potential ethical implications associated : Explore the potential ethical implications associated with this decision. Identify how the organization applies corporate social responsibility to the business.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write simple commission calculation program using IDE

Write a simple commission calculation program using IDE. Three Java application using Java NetBeans IDE to meet these additional and changed business requirements: The application will now compare the total annual compensation of at least two salespe..

  Write a program that simulates a simple calculator

Write a program that simulates a simple calculator. It reads two integers and a character. If the character is a +, the sum is printed; if it is a -, the difference is printed; if it is a *, the product is printed; if it is a /, the quotient is pr..

  Create an artificial life environment

Create an artificial life environment. You should have at least three types of agents: Herbivore, Carnivore, Plant

  What steps are involved in your analysis of this problem

Write code to process the 3 possible searches. Sample data is included for testing.

  Design implement test and debug a program with a jframe

design implement test and debug a program with a jframe that allows the user to enter a series of contacts names ages

  Design a program that does some polynomial operations

Implement polynomial addition by using an add() method, so you could write in program - Build a polynomial (linked list) from a file and the other from keyboard input (pairs of coefficients and powers) by a user.

  Create a complete java application that meets these

create a complete java application that meets these requirements1. the program has an opening comments section using

  Develop an application that counts the number of words

Develop an application that counts the number of words, number of characters with spaces and without spaced

  One-dimensional array to solve the

In C#, Use a one-dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who gros..

  Create the program which converts fahrenheit to celsius

Create the following program which converts Fahrenheit to Celsius. Read integer Fahrenheit temperatures from the user.

  Constructor that initializes the three automatic properties

Create a class called Date that adds three pieces of information as automatic properties-a   month (type int), a day (type int) and a year (type int).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd