Академический Документы
Профессиональный Документы
Культура Документы
Programming Exercises:
1. Copy the contents of one file into another and display the contents of
both files.
2. Accept the name of the file from command line and display its contents.
Also check whether that file is existed or not?
3. Convert the contents of a file into upper case.
4. Counts the numbers of lines of a file. Accept the file name from user.
5. Count total number of lower case characters of a file.
Objective questions:
2. What is the permanent effect on the file system of writing data to a new
FileWriter("report.txt"), given the file “report.txt” already exists?
a) The data is appended to the file
b) The file is replaced with a new file
c) An exception is raised as the file already exists
d) The data is written to random locations within the file
4. Which of the following is the correct syntax for suggesting that the JVM
performs garbage collection?
a) System.free();
b) System.setGarbageCollection();
c) System.out.gc();
d) System.gc();