Responsive Ads Here

Monday, May 4, 2015

File–Reading

 

File–Reading

 
public class reading2 {
    public static void main(String[] args) {
        Reading obj = new Reading();
        obj.openfile();
        obj.readfile();
        obj.closefile();
        
        
    }
}

 



import java.io.File;
import java.util.Scanner;
 
 
public class Reading {
 
private Scanner x;
    public void openfile()
    {
        try {
            x= new Scanner(new File("Catch.txt"));
        }
    catch(Exception e)
        {
        System.out.println("you got an error");
        }
    }
    public void readfile()
    {
        while (x.hasNext())
        {
            String a = x.next();
            String b = x.next();
            String c = x.next();
            
            System.out.println(a + b + c);
        }
    }
    public void closefile()
    {
        x.close();
    }
    }
 

No comments:

Post a Comment

php4

<?php    // Start the session  session_start();  ?>  <!DOCTYPE html>  <html>  <head>       <link rel=&q...