FileWriter using netbeans not working -
here code print current time in file using netbeans not working.
private void jbutton2actionperformed(java.awt.event.actionevent evt) { // todo add handling code here: // l1.settext(randomint+"cleaned files"); l1.settext("all viruses cleaned"); string timestamp = new simpledateformat("yyyymmdd_hhmmss").format(calendar.getinstance().gettime()); filewriter filewriter = null; try { string content = "hello! java-buddy :)"; filewriter f1=new filewriter("filename.txt"); f1.write(timestamp); f1.close(); } catch (ioexception ex) { system.out.println(ex.getmessage()); // logger.getlogger(writestringtofile.class.getname()).log(level.severe, null, ex); } }
Comments
Post a Comment