Java Assignment 4
- 1 1. Write a program that counts the no. of words in a text file. The file name is passed as a command line argument. The program should check whether thefile exists or not. The words in the file are separated by white space characters.
- 2 2. Explain difference between String class and String Buffer class.
- 3 3. Explain following keyword or short notes:
- 4 a. Static
- 5 b. Final
- 6 c. Finalizer
- 7 4. Write a program to create directories (/home/abc/bcd/def/ghi/jkl) in the homedirectory /home/abc and list the files and directories showing file/directory,file size. Read-write-execute permissions. Write destructor to destroy thedata of a class.
- 8 5. Explain File constructors, and any ten methods of class File and method seek.
- 9 6. A protected data or method can be accessed by any class in the same package.Justify.
- 10 7. There is no destructor in Java. Justify.
- 11 8. What are Java classes? How we can create java classes.
- 12 9. What is object? How we can create java objects?
- 13 10. Explain accesss pecifiers and compare their scope in tabular format.
- 14 11. What is Java string? How we can initialize and create java string explains with 10 methods?
- 15 12. String class in immutable explain.
- 16 13. Explain Java Character class with suitable example and methods