import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class JI9028653 {

	public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
		File file = File.createTempFile("temp1", ".tmp");
		System.out.println(file.getAbsolutePath());
		try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))){
//		try(FileInputStream fis = new FileInputStream(file);
//				ObjectInputStream ois = new ObjectInputStream(fis)){
			ois.readObject();
		} catch (EOFException exc) {
			// ok, expected
			System.out.println("Expected the EOF exception");
		}finally {
			System.out.println("File deleted?"+ file.delete());
		}
		if (file.exists()) System.out.println("File still exists, but should have been deleted");
	}
}
