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 21:04] gthanos [Παράδειγμα 2] |
java:class_file [2016/03/18 21:07] gthanos [Παράδειγμα 2] |
||
|---|---|---|---|
| Line 87: | Line 87: | ||
| <code java CreateEmptyFile.java> | <code java CreateEmptyFile.java> | ||
| + | |||
| + | import java.io.File; | ||
| public class CreateEmptyFile { | public class CreateEmptyFile { | ||
| Line 96: | Line 98: | ||
| File f = new File("./"+args[0]); | File f = new File("./"+args[0]); | ||
| if( !f.exists() ) { | if( !f.exists() ) { | ||
| - | f.createNewFile(); | + | try { |
| + | f.createNewFile(); | ||
| + | } catch( Exception ex ) { | ||
| + | ex.printStackTrace(); | ||
| + | } | ||
| } | } | ||
| } | } | ||