java:class_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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:07]
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() ) {
 +      try {
 +        f.createNewFile();​
 +      } catch( Exception ex ) {
 +        ex.printStackTrace();​
 +      }
 +    }
 +  }
 +}
 </​code>​ </​code>​
  
java/class_file.txt · Last modified: 2017/02/17 07:58 by gthanos