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 time complexity java?

951


Is java programming easy?

945


List some features of the abstract class.

1002


What is the difference between arraylist and hashset in java?

1066


What is the difference between JVM and JRE?

1051


Why parsing is done?

922


What methodology can be utilized to link to a database?

911


Can list have duplicates in java?

870


Is null function in java?

985


Explain about doubly linked list

980


What does %d do in java?

993


How is string immutable in java?

996


Can we extend a class with private constructor?

947


Write a function to find out longest palindrome in a given string?

1008


How do you get the length of a string in java?

948