Skip to content

Instantly share code, notes, and snippets.

@YongWanJin
Created August 7, 2023 11:56
Show Gist options
  • Save YongWanJin/976f117967b216fadb194c52a1d799e1 to your computer and use it in GitHub Desktop.
Save YongWanJin/976f117967b216fadb194c52a1d799e1 to your computer and use it in GitHub Desktop.
2023.08.07. Mission1 "깜짝과제" 1번
import java.util.*;
import java.io.*;
public class Mission1Surprise1 {
public static void main(String[] args) {
StringBuilder html = new StringBuilder();
html.append("<head>\n");
html.append(" <meta charset=\"UTF-8\"/>\n");
html.append(" <style>\n");
html.append(" table { border-collapse: collapse; width: 100%; }\n");
html.append(" th, td { border:solid 1px #000; }\n");
html.append(" </style>\n");
html.append("</head>\n");
html.append("<body>\n");
html.append(" <h1>자바 환경정보</h1>\n");
html.append(" <table>\n");
html.append(" <tr>\n");
html.append(" <th>키</th>\n");
html.append(" <th></th>\n");
html.append(" </tr>\n");
for(Object k : System.getProperties().keySet()){
String key = k.toString();
String value = System.getProperty(key);
html.append(" <tr>\n");
html.append(" <td>").append(key).append("</td>\n");
html.append(" <td>").append(value).append("</td>\n");
html.append(" </tr>\n");
}
html.append(" </table>\n");
html.append("</body>\n");
try{
File file = new File("index.html");
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(html.toString());
writer.close();
} catch(IOException e){
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment