answersLogoWhite

0


Best Answer

import java.util.Scanner;

import java.io.File;

public class Filedemo {

public static void main(String[] args)

{

Scanner input=new Scanner(System.in);

String s=input.nextLine();

File f1=new File(s);

System.out.println("File Name:"+f1.getName());

System.out.println("Path:"+f1.getPath());

System.out.println("Abs Path:"+f1.getAbsolutePath());

System.out.println("Parent:"+f1.getParent());

System.out.println("This file is:"+(f1.exists()?"Exists":"Does not exists"));

System.out.println("Is file:"+f1.isFile());

System.out.println("Is Directory:"+f1.isDirectory());

System.out.println("Is Readable:"+f1.canRead());

System.out.println("IS Writable:"+f1.canWrite());

System.out.println("Is Absolute:"+f1.isAbsolute());

System.out.println("File Last Modified:"+f1.lastModified());

System.out.println("File Size:"+f1.length()+"bytes");

System.out.println("Is Hidden:"+f1.isHidden());

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a java program that reads a file name from the user then displays information about whether the file exists whether it is readable writable type of file and the length of the file in bytes?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a software program that displays information that you retrieve from the Internet in a readable format?

it's called MICROSOFT OFFICE WORD!


What is a rectangular box that displays information or a program?

A screen (VDU).


What is the rectangular box that displays information or a program on windows 7?

a window


Code View Debug info use in vb 6?

The program should have a help area. search the helpe area for information about the debug information the program displays/


Where is the status bar?

The status bar is at the bottom of a program window, and it generally displays what the program is currently doing, or information about program objects you may have the cursor over, such as buttons or text boxes.


What is the human readable version of program called?

Source-code.


Why does your Microsoft Backup fail with an IO device error?

It is looking for a storage medium to write the backup information to, so there must be a CD/DVD drive with a writable disc in it before the program is started.


What happens to a c program when we didn't use compiler and execute program from .exe?

If you don't compile and execute your program, then it's not a program, just a bunch of source code which is worthless to the computer. The whole point of a compiler is to turn the human-readable code into machine-readable code.


What do you compile?

Compiling is the act of translating human-readable source code to machine-readable byte code.In Java, the compiler program is javac


Differentiate between the process of debugging and compiling?

compiling - automated machine translation of high order human readable program code to low level machine readable program code.debugging - manual human analysis of program failures to track down incorrectly coded operations that are the root cause of the program failure.


Which element of the word program window displays information about the current document such as numbers of pages and also includes the view and zoom buttons?

It's the ribbon.


Which software program displays advertising on your computer?

youtube