Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is wrapper class example?

991


Can subclass overriding method declare an exception if parent class method doesn't throw an exception?

1059


What is the multi-catch block in java?

1025


How do you find the absolute value?

1048


Explain the key functions of data binding?

1010


What is math in java?

1055


What is set string?

1165


What are heap memory and stack memory and what are memory tables.

976


What is the purpose of static methods and static variables?

1061


How many bits is size_t?

981


how can you take care of mutual exclusion using java threads? : Java thread

1035


What is the old name of java?

983


What is the purpose of the wait(), notify(), and notifyall() methods in java programming?

1068


What is the main difference between java platform and other platforms?

1086


What is the purpose of the finalize() method?

1244