Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class PetRecordDriver
- {
- private static final String FILE_NAME = "pets.txt" ;
- public static void main(String[] args)
- {
- String workingDirectory = System.getProperty("user.dir") ;
- String absolutePath = workingDirectory + "\\src\\" + FILE_NAME ;
- System.out.println("The absolute path is: " + absolutePath) ;
- // Set up Scanner and attach to "pets.txt"
- FileInputStream fileInputStream = null ;
- try
- {
- fileInputStream = new FileInputStream(absolutePath);
- }
- catch (FileNotFoundException e)
- {
- System.out.println("Couldn't find file " + FILE_NAME + " - aborting!");
- System.exit(0) ;
- }
- Scanner petScanner = new Scanner(fileInputStream);
- int pets = 9;
- PetRecord[] PetRecordArray = new PetRecord[pets]; //The array of pet records
- for (int x = 0; x > PetRecordArray.length; x++)
- {
- PetRecordArray[x] = new PetRecord();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement