<script type="text/javascript" src="https://platform.linkedin.com/badges/js/profile.js" async defer></script>
QA's approach 2 Java - File Creation with Date and Time
File Creation in java Example package fileHandling; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Scanner; public class CreateFile { /** * @param args * @throws ClassNotFoundException */ public static void main(String... args) throws ClassNotFoundException { String fileName = null; Scanner sc = new Scanner(System.in); System.out.println("Please enter the file name to create"); fileName = sc.next(); String filePath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "fileHandling" + File.separator + fileName + "_" + GetCurrentTimeStamp().replace(":", "_").replace(".", "_") + ".txt"; // System.out.println(filePath); File createNew = null; try { createNew = new File(filePath); // returns true if new file is created else is fi...
Comments
Post a Comment