import java.util.Scanner;
import java.io.PrintWriter;
import java.io.FileNotFoundException;


class Oct14 {
	public static void main(String[] args) {

		PrintWriter pw = null;

		try {
			pw = new PrintWriter("data.txt");
		}
		catch(FileNotFoundException e) {
			System.out.println("Error creating file");
			System.exit(0);	
		}		

		pw.println("This is println()");
		pw.printf("This is printf()\n");
		pw.print("This is print()\n");


		String name = "Joe";
		int age = 23;
		double height = 6.2;

		pw.printf("Name: %s, age: %d, height: %f\n", name, age, height);

		int[] arr = {9,8,7,6,5,4,3,2,1};

		// print contents of array to file	
		for(int i = 0; i < arr.length; i++) {
			pw.printf("%d ", arr[i]);
		}
		pw.println();
	
		pw.close();
	}
}
