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

When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

938


How to convert string to char and vice versa?

956


What is oops in java?

956


Explain the use of javap tool.

1094


What is not thread safe?

922


What is bool mean?

1003


What is nullpointerexception in java?

1039


What is the purpose of garbage collection in java, and when is it used?

983


java program with complete 4 oops concepts implemented example

3093


What do u mean by variable?

991


Can we cast any other type to boolean type with type casting?

893


How to optimize the javac output?

960


What is flag in python?

991


Can a constructor be protected?

1029


What is meant by method overriding?

1034