Java常用代码段 - 不定时更新中
记录一些自己写项目常用的代码段。
1.格式化常用日期格式
import java.io.IOException;import java.io.UnsupportedEncodingException;import java.net.URLDecoder;import javax.swing.JFrame;@SuppressWarnings("serial")public class Ini extends JFrame{private static String LOCATION;static { try { LOCATION = URLDecoder.decode(Ini.class.getProtectionDomain().getCodeSource().getLocation().getFile(),"UTF-8"); } catch (UnsupportedEncodingException e) { LOCATION = ""; }}public static void main(String[] args) throws IOException {System.out.println(LOCATION);}}