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. Add,delete,Update in LISTS

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

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

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

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

  6. An applet program that creates string dynamically and displays it

  7. An applet program to draw different shapes

  8. Corba program of game

  9. Program to evaluate following investment equation V=P(1+R)^N

  10. Program which creates an Array of character. Make one function with one argument as a character and that function throw a user defined exception

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

  12. Program to show an example of creating a class and using its object

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

  14. An applet program to display moving banner

  15. Program that takes a long sentence and a character from the client and count the occurrence of the character in the sentence at the server side

  16. An applet program showing Clicked Event on canvas

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

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

  19. An applet program to display alternate filled and empty circle that to in row and column format

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

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