Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 11 of 11

Thread: File question

  1. #1
    Member
    Join Date
    Apr 2013
    Location
    Ireland
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default File question

    currently writing a prog to carry out various operations as part of a module registration application. All info is taken from files,one option is to allow a student to deregister from a module do i have to delete the file to carry out this fuction two files will have to be updated when this function is carried out i have tried a few things but no use the method for this function is deregisterForModule
    import java.util.Scanner;
    import java.io.*;
    public class Project
    {
    	public static final int MAX_MODULES=15;
    	public static final int MAX_STUDENTS=40;
     
     
     
     
    	public static void main(String[] args) throws IOException
    	{
     
     
     
     
    		String[] userId = new String[MAX_STUDENTS];
    		String[] password = new String[MAX_STUDENTS];; 
    		String[] fName = new String[MAX_STUDENTS];; 
    		String[] lName = new String[MAX_STUDENTS];; 
    		int[] userType = new int[MAX_STUDENTS]; 
    		String[] choice1 =new String[MAX_MODULES];; 
    		String[] choice2 = new String[MAX_MODULES];; 
    		String[] mCode = new String[MAX_MODULES];; 
    		String[] mName = new String[MAX_MODULES];; 
    		int [] numberRegistered = new int [MAX_MODULES];
     
     
    		int numUsers = readUsers(userId, password, fName, lName, userType, choice1, choice2);
    		int numModules  = readModules(mCode, mName, numberRegistered);
    		int logedInIndex=logIn(userId, password, numUsers);
     
     
     
     
     
    		if (userType[logedInIndex]==1)
    		{
     
    			studentMenu(fName,lName,mCode, mName, numberRegistered, numModules, logedInIndex, choice1, choice2, numUsers,userId,userType);
     
    		}
    		else
    		{
     
    			adminMenu( mCode,  mName, numberRegistered, numModules, userId, 
    					fName,  lName, numUsers,logedInIndex,userType);
    		}
     
     
    	}
     
     
     
    	public static int readModules(String[] moduleCode, String[] moduleName, int[] numberRegistered) throws FileNotFoundException {
    		// TODO Auto-generated method stub
    		File file = new File("module.txt");
    		Scanner inputFile = new Scanner(file);
    		int i=0; 
    		while(inputFile.hasNext())
    		{
    			moduleCode[i]=inputFile.nextLine();
    			moduleName[i]=inputFile.nextLine();
    			numberRegistered[i]=inputFile.nextInt();
    			inputFile.nextLine();
    			i++;
    		}
    		inputFile.close();
    		return i;
    	}
     
     
     
    	public static int readUsers(String[] userId, String[] password,String[] firstName, String[] lastName, int[] userType,String[] choice1, String[] choice2) throws FileNotFoundException {
     
     
     
    		File file = new File("users.txt");
    		Scanner inputFile = new Scanner(file);
    		int i=0; 
    		while(inputFile.hasNext())
    		{
    			userId[i]=inputFile.nextLine();
    			password[i]=inputFile.nextLine();
    			firstName[i]=inputFile.nextLine();
    			lastName[i]=inputFile.nextLine();
    			userType[i]=inputFile.nextInt();
    			inputFile.nextLine();
    			choice1[i]=inputFile.nextLine();
    			choice2[i]=inputFile.nextLine();
    			i++;
    		}
     
    		inputFile.close();		
    		return i;
    	}
     
    	/**
    	 * Read and displays the contents of an input file.
    	 * @param inputFile The Scanner object that refers to the file that is to be read.
    	 * @param answers - the array of type boolean that will hold the answers to the questions but have to be "true or false".
    	 * @param question - the array of type String that stores all the questions for the test.
    	 * @return - returns the contents of the file.
    	 */
    	public static int readFile(Scanner inputFile, String[] userId, String[] password)
    	{
    		// Read lines from the file until no more are left.
    		int i = 0;
    		while (inputFile.hasNext() && i < MAX_STUDENTS)
    		{
    			// Read the next line.
    			userId[i] = inputFile.nextLine();
    			//System.out.println(question[i]);
    			password[i] = inputFile.nextLine();
    			//System.out.println(answers[i]);
    			inputFile.nextLine();
    			// Display the last line read.
    			//System.out.println(str);
    			i++;
    		}
    		return i;
     
    	}
    	/**
    	 * This method checks to use that the file name that was entered is valid.
    	 * the user wil be prompted to re-enter the name of the file until an acceptable file name is entered. 
    	 * @param prompt - this is a prompt that is used to tell the user what to do,
    	 * for example: "please enter your password".
    	 * @return returns the valid file name.
    	 */
    	public static File getValidFile(String prompt) 
    	{
     
    		String filename;     // The name of the file
    		File file;			
     
    		// Create a Scanner object for keyboard input.
    		Scanner keyboard = new Scanner(System.in);
     
    		// Get a valid file name.
    		do
    		{
    			System.out.print(prompt);
    			filename = keyboard.nextLine();
    			file = new File(filename);
    			if (!file.exists())
    				System.out.println("The specifed file does not exist - please try again!");
    		}while( !file.exists());
    		return file;
    	}
     
     
     
     
    	public static int logIn(String[] userId, String[] password, int numUsers)
    	{
    		System.out.println("CIT MODULE REGISTRATION - Login\n"+"===========================================================================");
    		Scanner keyboard = new Scanner(System.in);
    		int index;
    		do{
     
    			String userIdEntered=readStringUpper("ID number: "); 
    			String passwordEntered=readString("password: ");
    			index=find( userId, userIdEntered, numUsers);
    			if (index!=-1)
    			{
    				if (!userIdEntered.equals(userId[index]))
    				{
    					System.out.println("Login Failed because user Id is wrong Try Again!");
     
    					index=-1;
    				}
     
    				if (!passwordEntered.equals(password[index]))
    				{
    					System.out.println("Login Failed because password is wrong Try Again!");
     
    					index=-1;
    				}
     
     
    			}
    		}while(index==-1);
    		return index;	
     
    	}
     
     
     
    	/**Finds the index of a specified item in an array
    	 * @param x The array to be searched
    	 * @param value The value to be found
    	 * @return The index in the array at which the item is found */
    	public static int find(String[] x, String value, int numValues) {
    		int index = 0;
    		boolean found = false;
    		while(index < numValues && !found)
    		{
    			if (x[index].equals( value))
    				found = true;
    			else
    				index++;
    		}
    		if (found)
    			return index;
    		else
    			return -1;
    	}
     
     
     
     
     
    	public static String readString(String prompt)
    	{
    		String name;
    		Scanner keyboard = new Scanner(System.in);
    		do
    		{
    			System.out.print(prompt);
    			name=keyboard.nextLine();
     
    			if (name.length() <=1)
    			{
    				System.out.println("Error password must have more than one character");	
    			}
     
    		}while (name.length() <=1);
    		return name;
     
    	}
     
     
     
     
     
     
     
    	public static String readStringUpper(String prompt)
    	{
    		String name;
    		Scanner keyboard = new Scanner(System.in);
    		do
    		{
    			System.out.print(prompt);
    			name=keyboard.nextLine();
     
    			if (name.length() <=1)
    			{
    				System.out.println("Error Id number must have more than one character");	
    			}
     
     
    		}while (name.length() <=1);
    		return name.toUpperCase();
     
    	}
     
     
     
    	/*public static int getCustomerMenuChoice() 
    	{
    		System.out.println();
    		int menuChioce;
    		do {
     
     
    			menuChioce = readInteger ("Please enter one of the above options");
     
    			if (menuChioce <1 || menuChioce > 6)
    			{
    				System.out.println("You must enter a number between 1 and 6.");
    			}
    		}while (menuChioce <1 || menuChioce > 6);
     
     
    		return menuChioce;//The correct menu choice has been chosen.
    	}*/
    	//public static void menuChoice(int userType[],int logedInIndex)
    	//{
    	//}
     
    	public static void adminMenu(String[] mCode, String[] mName, int[] numberRegistered, int numModules,String[] userId, 
    			String[] fName, String[] lName,int numUsers,int logedInIndex,int[] userType) throws IOException
    			{
    		int select;
    		Scanner keyboard = new Scanner(System.in);
     
     
    		do
    		{
     
    			System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Admin]"+" "+"MODULE REGISTRATION "+" "+"[Main Menu]");
    			System.out.println("===========================================");
    			System.out.println(
    					"1 - Add a student\n" +
    							"2 - List all students\n" +
    							"3 - Add a module\n" +
    							"4 - List all modules\n" +
    							"5 - List students registered for a module\n" +
    					"6 - Exit\n");
     
     
    			select=readPositiveInteger("Please Choose Options 1 - 6: ");
     
     
    			switch (select)
    			{
    			case 1:
    				addStudent( fName, lName,logedInIndex);
    				break;
    			case 2:
    				listStudents( fName,  lName,  numberRegistered, numModules,logedInIndex,userType);
     
    				break;
    			case 3:
    				addModule( fName, lName,logedInIndex);
    				break;
    			case 4:
    				listAllModules(fName, lName,mCode, mName, numberRegistered, numModules,logedInIndex,userType);
     
    				break;
    			case 5:
    				studentsRegistered( userId,  fName,  lName, mCode,mName,numberRegistered, numUsers,logedInIndex);
    				break;
     
    			}
    		}while (select!=6);
     
    		goodbye();
     
     
    			}
    	private static void goodbye()
    	{
    		System.out.println("Goodbye Thank You For Using The CIT MODULE REGISTRATION");
    		System.out.println("You Are Logged Out");
    	}
    	public static void studentMenu(String[]fName,String[]lName,String[] mCode, String[] mName, int[] numberRegistered, int numModules, int logedInIndex, String[] choice1, String[] choice2, int numUsers,String[] userId ,int [] userType) throws IOException
    	{
     
    		int select;
    		Scanner keyboard = new Scanner(System.in);
    		do
    		{
    			System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Student]"+" "+"MODULE REGISTRATION "+" "+"[Main Menu]");
    			System.out.println("===========================================");
    			System.out.println(
    					"1 - List my current modules\n" +
    							"2 - Register for a module\n" +
    							"3 - Deregister for a module\n" +
    							"4 - List all modules\n" +
    					"5 - Exit\n");
     
     
     
    			select=readPositiveInteger("Please Choose Options 1 - 5: ");
    			switch (select)
    			{
    			case 1:
    				listCurrentModules(fName,lName,choice1, choice2, numUsers, mCode, mName, numModules,  logedInIndex);
    				break;
    			case 2:
    				registerForModule(mCode,userId, fName, lName, logedInIndex);
     
    				break;
    			case 3:
    				deregisterForModule(fName, lName,logedInIndex,numberRegistered);
    				break;
    			case 4:
    				listAllModules(fName, lName,mCode, mName, numberRegistered, numModules,logedInIndex,userType);
    				break;
    			}
     
    		}	
    		while (select!=5);
    		goodbye();
     
    	}
     
    	public static void listCurrentModules(String[]fName, String[]lName,String[] choice1, String[] choice2, int numUsers, String[] moduleCode, String[] moduleName, int numModules,int logedInIndex) {
     
    		System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Student]"+" "+"MODULE REGISTRATION "+" "+"[My Modules]");
    		System.out.println("===========================================");
     
    		System.out.println("Module Code\tModule Name");
    		System.out.println("-----------\t------------------");
     
    		int moduleChoice1Index = find(moduleCode, choice1[logedInIndex], numModules);
     
    		int moduleChoice2Index = find(moduleCode, choice2[logedInIndex], numModules);
    		if (moduleChoice1Index != -1)
    		{
    			System.out.println("1. " + choice1[logedInIndex] + "\t" + moduleName[moduleChoice1Index]);
    		}
    		else
    		{
    			System.out.println("1. " + choice1[logedInIndex] + "\tUnspecified");
    		}
    		if (moduleChoice2Index != -1)
    		{
    			System.out.println("2. " + choice2[logedInIndex] + "\t" + moduleName[moduleChoice2Index]);
    		}
    		else
    		{
    			System.out.println("2. " + choice2[logedInIndex] + "\tUnspecified");
    		}
     
    	}
    	public static String listAllModules(String[] fName,String[] lName,String[] moduleCode, String[] moduleName, int[] numberRegistered, int numModules,int logedInIndex,int[] userType) {
    		if (userType[logedInIndex]==1)
    		{
     
    			System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Student]"+" "+"MODULE REGISTRATION "+" "+"[List All Modules]");
    			System.out.println("===========================================");
     
    		}
    		else
    		{
    			System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Admin]"+" "+"MODULE REGISTRATION "+" "+"[List All Modules]");
    			System.out.println("===========================================");
     
    		}
    		System.out.println("Code\t" +  "\tModule Name" +  "\t\tNumbers");
     
    		for(int i=0; i<numModules; i++)
    		{
    			System.out.println(moduleCode[i]+ " "+"\t" + moduleName[i] + "\t" + numberRegistered[i]);
     
    		}
     
    		return null;
    	}
     
    	public static void deregisterForModule(String[] fName,String[] lName,int logedInIndex,int []numberRegistered) throws IOException {
    		System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Student]"+" "+"MODULE REGISTRATION "+" "+"[Deregister For Module]");
    		System.out.println("===========================================");
    		Scanner keyboard = new Scanner(System.in);
     
    		String moduleCode;
     
     
     
     
     
    		// Get data and write it to the file.
    		// Open the file for appending      
    		FileWriter fw = new FileWriter("module.txt", true);  
    		PrintWriter outputFile = new PrintWriter(fw);
    		// Get the name of a friend.
    		System.out.print("Enter the Module Code");
    		moduleCode = keyboard.nextLine();
     
     
     
     
     
     
    		// Close the file.
    		outputFile.close();
    		System.out.println("Data written to the file.");
    	}
    	public static void registerForModule(String [] moduleCode,String[] userId,String[] fName,String[] lName, int logedInIndex) throws IOException 
    	{
     
    		System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Student]"+" "+"MODULE REGISTRATION "+" "+"[Register For Module]");
    		System.out.println("===========================================");
    		Scanner keyboard = new Scanner(System.in);
    		String filename;
    		String moduleReg;
     
     
     
    		// Consume the remaining newline character.
     
    		// Get data and write it to the file.
    		// Open the file for appending      
    		FileWriter fw = new FileWriter("user.txt", true);  
    		PrintWriter outputFile = new PrintWriter(fw);
    		// Get the name of a friend.
    		System.out.print("Enter the Module Code");
    		moduleReg = keyboard.nextLine();
    		// Write the name to the file.
    		outputFile.println(moduleReg);
     
     
     
     
    		// Close the file.
    		outputFile.close();
    		System.out.println("Data written to the file.");
    		// method must be written
     
    	}
     
    	public static void addStudent(String[] fName,String[] lName,int logedInIndex) throws IOException 
    	{
     
    		System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Admin]"+" "+"MODULE REGISTRATION "+" "+"[Add Student]");
    		System.out.println("===========================================");
    		Scanner keyboard = new Scanner(System.in);
    		String studentId;
    		String password;
    		String firstName;
    		String lastName;
    		String module="unspecfied";
     
    		int userType=1;
     
     
     
    		// Get data and write it to the file.
    		// Open the file for appending      
    		FileWriter fw = new FileWriter("user.txt", true);  
    		PrintWriter outputFile = new PrintWriter(fw);
    		// Get the name of a friend.
    		System.out.print("Enter Student Id");
    		studentId = keyboard.nextLine();
    		System.out.print("Enter Password");
    		password = keyboard.nextLine();
    		System.out.print("Enter Students First Name");
    		firstName=keyboard.nextLine();
    		System.out.print("Enter Students Last Name");
    		lastName=keyboard.nextLine();
     
     
     
     
    		// Write the name to the file.
     
    		outputFile.println(studentId);
    		outputFile.println(password);
    		outputFile.println(firstName);
    		outputFile.println(lastName);
    		outputFile.println(userType);
    		outputFile.println(module);
    		outputFile.println(module);
     
     
    		// Close the file.
    		outputFile.close();
    		System.out.println("Data written to the file.");
     
     
    	}
    	public static void studentsRegistered(String[] userId, 
    			String[] fName, String[] lName,String[] mCode, String[] mName,int[] numberRegistered, int numUsers,int logedInIndex)
    	{
    		System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Admin]"+" "+"MODULE REGISTRATION "+" "+"[Stuents Registered]");
    		System.out.println("===========================================");
    		Scanner keyboard = new Scanner(System.in);
     
    		String mod;
     
    		{
    			System.out.println("Please enter module code:");
    			mod=keyboard.nextLine();
     
    			if(mod.equals(mCode[logedInIndex]))
    			{
    				System.out.println(fName[logedInIndex]);
    			}
    			else{
    				System.out.println("no");
    			}
    		}    }
    	public static void addModule(String[] fName, String[] lName,int logedInIndex) throws IOException
    	{
    		System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Admin]"+" "+"MODULE REGISTRATION "+" "+"[Add Module]");
    		System.out.println("===========================================");
    		Scanner keyboard = new Scanner(System.in);
     
    		String moduleCode;
    		String moduleName;
    		int numRegister=0;
     
     
     
    		// Get data and write it to the file.
    		// Open the file for appending      
    		FileWriter fw = new FileWriter("Modules.txt", true);  
    		PrintWriter outputFile = new PrintWriter(fw);
    		// Get the name of a friend.
    		System.out.print("Enter the Module Code");
    		moduleCode = keyboard.nextLine();
    		System.out.print("Enter the name of Module");
    		moduleName = keyboard.nextLine();
     
     
    		// Write the name to the file.
    		outputFile.println(moduleCode);
    		outputFile.println(moduleName);
    		outputFile.println(numRegister);
     
    		// Close the file.
    		outputFile.close();
    		System.out.println("Data written to the file.");
     
    	}
    	public static void listStudents(String[] fName, String[] lName, int[] numberRegistered,int numModules,int logedInIndex,int[] userType ) throws FileNotFoundException 
    	{
    		System.out.println( fName[logedInIndex] +"  " + lName[logedInIndex] +"   "+ "[Admin]"+" "+"MODULE REGISTRATION "+" "+"[List Students]");
    		System.out.println("===========================================");
     
     
     
    		System.out.println("Module code\tModule Name\tStudents Regestered\n===========\t============\t=============");
     
     
    		{
     
     
    		}
     
    	}
     
     
     
    	public static int readInteger(String prompt)
    	{
    		// Create a scanner object for input from the console window
    		Scanner keyboard = new Scanner(System.in);
     
    		// boolean flag which is used to control the 
    		// data validation loop
     
    		boolean numGood = false; // Assume the worst	
    		do
    		{
    			System.out.print(prompt);  // ask for the value
    			if(!keyboard.hasNextInt()) // check if what's in the keyboard buffer is not an integer
    			{
    				System.out.println("You must enter an integer value!"); // display an error message
    				keyboard.nextLine(); // consume the bad value entered
    			}
    			else
    				numGood = true; // value entered is good
    		} while(!numGood);
    		// at this point we know the value in the
    		// keyboard buffer is numeric so we can go ahead and
    		// return it.
    		return keyboard.nextInt();
    	}
    	public static int readPositiveInteger(String prompt)
    	{
    		int value;
    		do
    		{
    			value = readInteger(prompt); // ask for and read an integer value
    			if (value < 0) // check if the value entered is less than 0
    				// display an error message
    				System.out.println("Error - you must enter a positive integer value!");
    		} while (value <0);
    		// at this point we know the value entered is positive
    		// so return it
    		return value;
    	}
     
    }


    these are the files being used
    users.txt
    S1234
    apple
    Jack
    Black
    1
    SOFT6017
    noselection
    A1234
    peach
    Belinda
    Blake
    2
    noselection
    noselection
    S456
    banana
    John
    Smith
    1
    COMP6026
    SOFT6002
    S789
    apricot
    Mary
    Murphy
    1
    CMOD6001
    noselection

    module.txt
    COMH6002
    Computer Architecture
    0
    COMH6003
    Computer Hardware
    1
    CMOD6001
    Creativity Innov & Team
    1
    MATH6000
    Essential Maths
    3
    SOFT6002
    Introduction to HCI
    4
    COMP6026
    Network Fundamentals 1
    5
    COMP6027
    Network Fundamentals 2
    10
    SOFT6018
    Problem Solving & Prog 1
    2
    SOFT6017
    Problem Solving & Prog 2
    2
    STAT6000
    Stats & Probability
    2
    SOFT6007
    Web Dev Fundamentals
    2
    COMP6023
    Web Publishing
    0
    MATH7777
    Probability
    10


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: File question

    one option is to allow a student to deregister from a module
    What changes need to be made to the file for a student to deregister?
    If data is to be removed from the file, the contents of the file will have to be changed by rewriting the file.
    If there are no contents for the new file, then the old file could be deleted.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member
    Join Date
    Apr 2013
    Location
    Ireland
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: File question

    in modules.txt the number registered will have to change and the user.txt file will have to change as well

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: File question

    For such small files, read the whole file into a list of some kind, update the records in the list and then write the contents of the updated list back to the file when the updates are done.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Member
    Join Date
    Apr 2013
    Location
    Ireland
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: File question

    to be honest youve lost me do u mean like the readfile method

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: File question

    Whatever method is used to read the data from the file, it should save ALL the data in a list in the program.
    The list can be updated and then the data can be written back to the file, replacing the old contents of the file with the updated data.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Member
    Join Date
    Apr 2013
    Location
    Ireland
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: File question

    oh get you now yes every bit of info goes to an array /list i have tried to do that but just wont work i know how to append the file but not a certain part of the file

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: File question

    When updating a file, you need to replace the whole of the current contents with the new contents. You do NOT want to append the new contents to the file's old contents.
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Member
    Join Date
    Apr 2013
    Location
    Ireland
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: File question

    never done that im afraid

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: File question

    There will be a lot of first times as you learn java.

    Try writing a small simple program for testing different techniques for reading a file, updating its contents and writing it out again for practice before trying to add code to this large program.
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Member
    Join Date
    Apr 2013
    Location
    Ireland
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: File question

    thanks will do

Similar Threads

  1. [SOLVED] Question about reading numbers from external file
    By leonne in forum Java Theory & Questions
    Replies: 14
    Last Post: January 15th, 2013, 01:22 PM
  2. Java IO File Reader Question???
    By liamShannon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 12th, 2011, 03:37 PM
  3. Creating New File types question.
    By GodspeedPR in forum Java Theory & Questions
    Replies: 1
    Last Post: July 1st, 2011, 09:05 AM
  4. File class theoretical question
    By Darqneez in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: June 23rd, 2011, 04:25 PM
  5. Java File IO question :confused:
    By byebyebye in forum File I/O & Other I/O Streams
    Replies: 9
    Last Post: August 17th, 2010, 06:45 AM