Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To write a java program that reads a file name from the user, displays information about whether the file exists, whether the file is readable,

To write a java program that reads a file name from the user, displays information about whether the file exists, whether the file is readable, or writable, the type of file and the length of the file in bytes. Algorithm:

image text in transcribed

1. Start 2. Create a class filedemo. Get the file name from the user. 3. Use the file functions and display the information about the file. 4. getName() displays the name of the file. 5. getPath() diplays the path name of the file. 6. getParent()-This method returns the pathname string of this abstract pathname's parent, or 7. null if this pathname does not name a parent directory. 8. exists() - Checks whether the file exists or not. 9. canRead()-This method is basically a check if the file can be read. 10. canWrite()-verifies whether the application can write to the file. 11. isDirectory() - displays whether it is a directory or not. 12. isFile() - displays whether it is a file or not. 13. lastmodified) - displays the last modified information. 14. length()- displays the size of the file. 15. delete() - deletes the file 16. Invoke the predefined functions to display the information about the file. 17. Stop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

Needed for night vision?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago

Question

c. How is trust demonstrated?

Answered: 1 week ago

Question

Have issues been prioritized?

Answered: 1 week ago