Java Tutorial


class  DirList
    public static void main(String[] args) 
         String dirname= \"e:/songs\";
         File f1 = new File(dirname);

    if (f1.isDirectory())
              System.out.println(\"Directory of \" + dirname);
              String s[] = f1.list();

              for (int i=0;i<s.length ;i++ )
                    File f = new File(dirname + \"/\"+ s[i]);
                    if (f.isFile()){
                         System.out.println(s[i] + \" is a File\");
                        System.out.println(s[i] + \" is a directory\");
           System.out.println(dirname + \" is not  a directory\");

    Related Post:
  1. Program that enabled applet calculator

  2. Program to show the use of Bitwise Operator (^) XOR (Exclusive OR)

  3. Program to find a factorial of a given number

  4. RMI servlet program to display message

  5. Program of insertion sort

  6. Program to show an example of using constructors in a class to initialize its data members

  7. Define an array of ten String elements each containing an arbitrary string of the form “month/day/year”

  8. RMI application for getting the final total price of the shopping list with some of the following items and quantities chosen by the user

  9. Program of creating a file using text fields in windows

  10. Program to show the use of Labeled Continue Statement

  11. An applet program that displays random dot

  12. Program of storing and retrieving integers using data streams on a single file

  13. An applet program to add two numbers where data is entered in TextField

  14. Program to show the use of Conditional (Ternary) Operator

  15. Program to show an example of Calling a Base Class Method from a Derived Class

  16. Encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time after each word in the sent

  17. Program to display attributes of a specified file

  18. Program to show an example of using user-defined package in a program

  19. CORBA based application for addition of two mathematical expressions of the form (ax + by) and displaying the result on client side

  20. Program to convert the given temperature in faherenhiet to celsius using the following conversion formula C= F- 32/1.8

Didn't find what you were looking for? Find more on File handling program to display directory contents