Home arrow static arrow Java Programming [Archive] - I cant get length() and last modifed() to work right
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - I cant get length() and last modifed() to work right
This topic has 5 replies on 1 page.

Posts:31
Registered: 6/21/04
I cant get length() and last modifed() to work right  
Jun 23, 2004 7:13 AM



 
/*
* Created on Jun 22, 2004
*/

/**
* @author adam
*/
import java.io.File;
import java.io.IOException;
import java.util.Date;

public class Length {

public static void main(String[] args) throws IOException{
File myFile = new File("blah.txt");
if(!myFile.exists()){
myFile.createNewFile();
}
System.out.println("File length - "+ myFile.length());
System.out.println( "File last modified - "+ new
Date(myFile.lastModified()).toLocaleString() );
}
}

How do I get to look at the blah.txt??
 

Posts:31
Registered: 6/21/04
Re: I cant get length() and last modifed() to work right  
Jun 23, 2004 7:14 AM (reply 1 of 5)



 
the blah.txt that I already have made
 

Posts:5,627
Registered: 3/22/04
Re: I cant get length() and last modifed() to work right  
Jun 23, 2004 7:16 AM (reply 2 of 5)



 
print out each line.
 

Posts:5,627
Registered: 3/22/04
Re: I cant get length() and last modifed() to work right  
Jun 23, 2004 7:17 AM (reply 3 of 5)



 
...or print out some amount of data and then get some more.
 

Posts:31
Registered: 6/21/04
Re: I cant get length() and last modifed() to work right  
Jun 23, 2004 7:22 AM (reply 4 of 5)



 
What im asking is how do I get it to look at a file that is not in C:\Program Files\NetBeans3.6
 

Posts:31
Registered: 6/21/04
Re: I cant get length() and last modifed() to work right  
Jun 23, 2004 7:28 AM (reply 5 of 5)



 
nevermind I got it
 
This topic has 5 replies on 1 page.