import java.io.*;
class Demo
{
public static void main(String args[])
{
File f=new File("1234.msg");
String arr[]=f.list();
System.out.println(arr.length);
}
}
Answer Posted / meziane
The list() of the class java.io.File "returns an array of Strings naming the files and directories in the directory denoted by this abstract pathname."
http://docs.oracle.com/javase/6/docs/api/java/io/File.html#list%28%29
The abstract pathname is the path specified in File f = new File(patAsString).
The method returns null, if the abstract pathname does not denote a directory (i.e an existing directory).
No compilation error.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is node a data type in java?
What is the default size of load factor in hashing based collection?
Can singleton class be serialized?
Can we have any code between try and catch blocks?
What is an argument java?
What is the final keyword in java?
What are green threads in java?
Why string objects are immutable in java?
Is string is a data type in java?
What is the association?
Which types of exceptions are caught at compile time?
What is size_t?
What is the collections api in java programming?
Write a program to check for a prime number in java?
What is better- service oriented or batch oriented solutions?