Tuesday, January 19, 2010

How Much Is Blue Hair

code with some methods of the File class

package progettofile3;

import java.io. *;

/
** * * @ author
We
* / public class Main {


/
** * @ param args the command line arguments
* /
public static void main (String [] args) throws Exception {

File f;
InputStream in = System.in; System.out.println ("filename ??");

String s t.readLine = ();
f = new File (s);

if (f.exists ()) System.out.println (f.getName () + "exists") else {System.out.println (f.getName () + "does not exist") System.exit (0);}

if (f.isDirectory ()) {
String [] files = f.list ();
for (String m : file) System.out.println (m);
System.exit (0);}


End = new FileInputStream FileInputStream (f);
int n = 0;
while ((n = fin.read ())!= -1) {System.out.print

((char) n);}
/ / TODO code application logic here


}}



0 comments:

Post a Comment