Java Blog

 
 
 
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 show an example of creating String objects from Character Arrays

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

  3. Program to read the table elements into a two-dimensional array temperature

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

  5. Write a program for restaurant

  6. Program which will read a string and rewrite it in the alphabetical order

  7. corba program of client and a DNS server where given a URL the server sends back an IP address

  8. 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

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

  10. An applet program showing Clicked Event on canvas

  11. Program to show the use of Break Statement

  12. Program to read command line arguments

  13. Program to show an example of using a Non-Static Nested Class

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

  15. An applet program to perform selection sort

  16. Program to show an example of using initialization block to initialize the data members of a class

  17. Program that will read real number from the keyboard and print the following output in one line: small Integer not less The Given Number Largest Int

  18. Program to declare, initialize and print a String object

  19. Program to show an example of extraction of characters from a StringBuffer objects

  20. Program of inventory management and demonstrating interactive input and output

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