Answer to Question #270468 in Java | JSP | JSF for Maurice Honour

Question #270468

Develop a java console banking system and

Implement the following java concept in your solution and highlight in your documentation or code where you did it:

1. Class and Object

2. File and Stream

3. Exception Handling



1
Expert's answer
2021-11-24T00:43:50-0500


SOLUTION TO THE ABOVE QUESTION


package com.company;

import java.io.*;
//Define a class called File_handling_class
public class File_handling_class {

    public static void main(String args[]) throws IOException {
        //Lets us two objects one for input stream and the other for output stream
        FileInputStream input_object = null;
        FileOutputStream output_object = null;

        //Let us handle exception using the try block
        try {
            input_object = new FileInputStream("input.txt");
            output_object = new FileOutputStream("output.txt");

            int condition;
            while ((condition = input_object.read()) != -1) {
                output_object.write(condition);
            }
        }finally {
            if (input_object != null) {
                input_object.close();
            }
            if (output_object != null) {
                output_object.close();
            }
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS