This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
java:class_file [2016/03/18 20:49] gthanos |
java:class_file [2016/03/18 21:05] gthanos [Παράδειγμα 2] |
||
---|---|---|---|
Line 87: | Line 87: | ||
<code java CreateEmptyFile.java> | <code java CreateEmptyFile.java> | ||
+ | |||
+ | import java.io.File; | ||
+ | |||
+ | public class CreateEmptyFile { | ||
+ | public static void main(String args[]) { | ||
+ | if( args.length == 0 ) { | ||
+ | System.out.println("Insufficient number of arguments!"); | ||
+ | return; | ||
+ | } | ||
+ | File f = new File("./"+args[0]); | ||
+ | if( !f.exists() ) { | ||
+ | f.createNewFile(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
</code> | </code> | ||