Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Using java.io.File object (See related posts)

Using java.io.File object

import java.io.*;

class Main {
	static String filename = new String("/home/sascha/temp/changes.xml");	
	
	public static void main(String[] args) {
		File fileObject;
		System.out.println("Reading File: " + filename);

		fileObject = new File(filename);
		
		System.out.println("Filename: " + fileObject.getName());
		System.out.println("Length: " + (fileObject.length()) + "bytes");
		System.out.println("Last modified timesptamp: " + fileObject.lastModified());
	}

}


You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts