Java Tutorial

 
 
 
 
import java.io.*;


import java.util.*;
/**
 *
 * @author Hira
 */
public class Filespaths {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
        Path p=Paths.get(\"C:\\\\outfile\\\\outfile.txt\");
        System.out.println(p);
        System.out.println(p.toAbsolutePath().toString());
        System.out.println(p.getParent());
        System.out.println(p.getRoot());
        System.out.println(Files.exists(p));
         System.out.println(p.getFileName());
         Files.deleteIfExists(p);


        } catch (IOException ex) {
            System.err.println(ex.getMessage());
        }

    List<Integer> e=Arrays.asList(2,3,5,6,7,8,0);
    List<Integer> f=Arrays.asList(12,13,14,15,16,12,18);
    System.out.println(e);
    System.out.println(f);
    try{
    for(int i=0;i<e.size();i++){
        int o=f.get(i)%e.get(i);
        System.out.println(o);   
    }
    }catch(ArithmeticException g){
        System.err.println(\"Exception caught :\"+g.getMessage());
    }
    }
}

    Related Post:
  1. Program to display triangle of numbers

  2. Program to show an example of creating Character Arrays from String objects

  3. Program that enabled applet that takes name of the user. Server returns back the number in uppercase clubbed with “HELLO” and display it on applet

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

  5. Pass the marks of 10 students from the client side design a servlet, which takes these marks and returns the number of students who obtained first cls

  6. Program to determine the sum of the following harmonic series for a given value of n

  7. Program to show the use of Nested Loops

  8. Program to change characters in a StringBuffer objects and to reverse its contents

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

  10. Biological Sequence Allignment Using Dynamic Programing

  11. Program for Thread Priority

  12. Program to check the start and end of a String

  13. Program to declare, initialize and print a StringBuffer object

  14. Program using session tracking capability of Servlets, which displays information of current user session by HttpServletRequest object

  15. Dialog Boxes

  16. Program to show an example of overloading constructors in a class to initialize its data members

  17. Program to declare, initialize and print a 2D array of integers

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

  19. Program to show an example of creating String objects from Character Arrays

  20. Program to declare, initialize and print an array of characters

 
 
Didn't find what you were looking for? Find more on File Handling- JAVA