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 of an applet to illustrate BarChart

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

  3. Program to show an example of using multiple classes in a program

  4. Program to ask question and accept answer up to 3 attempt and display right answer if it is wrong

  5. An applet program to display sum of two number of textField

  6. Application which takes your marks of six subjects from the client side and displays the percentage that you have obtained

  7. Program to show the use of Bitwise Operator (~) Complement

  8. An applet program of passing parameters

  9. Create an interface coversions. Which have the following functions Inchestomillimeters(), hptowatts(),wattstohp(),poundstogram(),gramtopounds()

  10. program which takes a long sentence from the client passes to the server,server separates out each word and sends them back to client in reverse order

  11. Program to compare Strings by compring successive corresponding characters, starting with the first character in each String

  12. Program to show insertion of StringBuffer, String objects and other Basic Data Types into a StringBuffer object

  13. RMI application for counting factorial of a given number.

  14. Program to show the use of Conditional AND Operator (&&) in If Statements

  15. Program to show the use of Nested Loops

  16. Develop a CORBA application that takes a string from client and returns whether it is palindrome

  17. Program sets up a String variable containing a paragraph of text of your choice. Extract the words from the text and sort them into alphabetical order

  18. An applet program to perform selection sort

  19. Program to declare and initialize Boolean variables and print them on the Standard Output Device

  20. An applet program to take user input and display

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