Thread: Open File
View Single Post
  #6 (permalink)  
Old 07-12-2008, 07:41 PM
Nicholas Jordan's Avatar
Nicholas Jordan Nicholas Jordan is offline
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 1,018
Rep Power: 3
Nicholas Jordan is on a distinguished road
Default oversimplified place to start
Originally Posted by Engineeringserver.com View Post
You can use the File class to open a file and the scanner class to read it. It isn't that difficult to write a simple text reader.
Java Learner,

These other two posters are heavily experienced, I did not try to get this to compile: They can help you with this:

Code:
import java.io.File;// 
import java.io.PrintWriter://
public class FileDemo
{
    public static void main(String[] args)
    {
        // Simple
        for(int i= 0;i < args.length;i++)
        {
            File nextFile = new File(args[i]);
            if(nextFile.exists())
            {
                ;// That file already exists.
            }
            else
            {
                PrintWriter printWrite
                =
                new PrintWriter(nextFile);
        }
    }
}
__________________
Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Reply With Quote