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