文件操作的问题 GregorianCalendar calendar = new GregorianCalendar();String sdt = calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-" + calendar.get(Calendar.DATE);这个是得到类似于yyyy-mm-dd的时间格式,相信你能看出如何写出你要的格式了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try{ PrintWriter out = new PrintWriter(new FileWriter(new File("a.txt"), true));//这样就可以了。注意那个true就决定了是创建新的还是append到旧文件里面。}catch(IOException e){ e.printStackTrace();} public static String getSysDate() { String dateTime = ""; Date sysDate = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); StringBuffer tb = new StringBuffer(); dateTime = sdf.format(sysDate, tb, new FieldPosition(0)).toString(); return dateTime; } public void csvFileOpen(String fileName) throws IOException { PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(fileName))); String s = "sssss"; pw.println(s); pw.flush(); pw.close(); } 对于Java核心包中的类,已知全类名和欲生成对象的字符串形式,如何构造对象 多线程并发求教 请问,java 如何在JPanel指定位置放置JTextPane 中文String转utf8,再转回中文 在java编写的绘图程序中怎样实现局部刷新 JTable 中的事件操作 大虾你们好,现在我想在JTable加上一列“序号”。请帮忙! 求助!!!!!!! 关于给动态创建对象加actionLister 我是新手~~问一比较弱的问题~~ 请斑竹保留一天,对仓库熟悉又想兼职的 大家谈谈对反射的理解
PrintWriter out = new PrintWriter(new FileWriter(new File("a.txt"), true));//这样就可以了。注意那个true就决定了是创建新的还是append到旧文件里面。}catch(IOException e){
e.printStackTrace();
}
String dateTime = "";
Date sysDate = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
StringBuffer tb = new StringBuffer();
dateTime = sdf.format(sysDate, tb, new FieldPosition(0)).toString();
return dateTime;
}
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(fileName)));
String s = "sssss";
pw.println(s);
pw.flush();
pw.close();
}