My Programming Lab REVEL Exercise Given a Scanner reference

My Programming Lab REVEL Exercise:

Given a Scanner reference variable, stdin, that is associated with standard input, read in two words. Use the first word as the name of a file to create and store the second word in. Make sure that the data written to the file has been flushed from its buffer and that any system resources used during the course of running these statements have been released. (Do not concern yourself with any possible exceptions here -- assume they are handed elsewhere.)

***NOTE- you do not need the entire section of code, just need the part that does what the question asks. For example, REVEL will not recognize class names for this question as it is not given. It is just an exercise, not a full program.***

Solution

myDouble2 = new Double(x);
myDouble = myDouble2;

private List<String> readFile(String filename)
throws Exception
{
String line = null;
List<String> records = new ArrayList<String>();

// wrap a BufferedReader around FileReader
BufferedReader bufferedReader = new BufferedReader(new FileReader(filename));

// use the readLine method of the BufferedReader to read one line at a time.
// the readLine method returns null when there is nothing else to read.
while ((line = bufferedReader.readLine()) != null)
{
records.add(line);
}
  
// close the BufferedReader when we\'re done
bufferedReader.close();
return records;
}

My Programming Lab REVEL Exercise: Given a Scanner reference variable, stdin, that is associated with standard input, read in two words. Use the first word as t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site