import java.io.*;
public class Tabelline {
public static void main(String[] args) {
File fileHTML = new File("tabelline.html");
FileWriter streamHTML = null;
try {
streamHTML = new FileWriter(fileHTML);
}
catch(IOException e) {
System.out.println("Impossibile aprire il file.");
System.out.println("JVM ha sollevato l'eccezione: " + e);
System.exit(0);
}
PrintWriter pwHTML = new PrintWriter(streamHTML);
String mioTitolo = "Tabelline!";
pwHTML.print("<html>\n<head>\n<title>" + mioTitolo + "</title>\n</head>\n");
pwHTML.print("<body bgcolor=\"#ffffff\">\n");
pwHTML.print("<b>Tabelline</b><br /><br />\n");
pwHTML.print("<table border=\"3\" cellpadding=\"10\">\n");
pwHTML.print("<tr><td> </td>\n");
for(int j=1; j<=10; j++) {
pwHTML.print("<th>" + j + "</th>\n");
}
pwHTML.print("</tr>\n\n");
for(int i=1; i<=10; i++) {
pwHTML.print("<tr>\n<th>" + i + "</th>\n");
for(int j=1; j<=10; j++) {
pwHTML.print("<td>" + i*j + "</td>\n");
}
pwHTML.print("</tr>\n\n");
}
pwHTML.print("</table>\n");
pwHTML.print("</body>\n</html>");
pwHTML.close();
}
}