Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » File HandlingRSS Feeds

File Handling- JAVA

Posted By: Falak Khan     Category: Java     Views: 314466

Code for File Handling- JAVA in Java

import java.io.*;


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

    /**     * @param args the command line arguments     */publicstaticvoid 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());
    }
    }
}
  
Share: 

 
 
 

Didn't find what you were looking for? Find more on File Handling- JAVA Or get search suggestion and latest updates.

Falak Khan
Falak Khan author of File Handling- JAVA is from Pakistan.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Rosered Red from United States Comment on: Apr 25
There are several users are facing these kinds of issues as they may not handle the iPad in an appropriate manner. They can take any advice suggested by https://errorcode0x.com/fix-epson-printer-error-code-0x97/ that will be beneficial for them to overcome their issues.

View All Comments