/*********************Pay Button Listener***************************************/
	public class payListener implements ActionListener{
		public void actionPerformed(ActionEvent e) {
			
			
			String fileName2 = "Ticket/"+ticketIDNumber+".dat";
			File ticket2 = new File(fileName2);
			if(ticket2.exists()){
				try{
					FileReader fileReader = new FileReader(fileName2);
					BufferedReader bufferedReader = new BufferedReader(fileReader);
					bufferedReader.readLine(); //OMIT Entrance Time 
					
					FileWriter fw = new FileWriter(fileName2);
					BufferedWriter bufferedWriter = new BufferedWriter(fw);
					//fw.write("Hello");
				
					bufferedReader.close();
					fileReader.close();
					fw.close();
				}
				catch(IOException f){
					System.out.println("Error in Setting Payment Time for ticket");
				}		
			}
			
			}
		}
	
	
	/*********************Pay Button Listener***************************************/

Someone please show me how to replace content in file, only the 2nd line please. current file looks like this:

1324254875443
1313131
Paid
0.0

Recommended Answers

All 2 Replies

Duplicate thread
http://www.daniweb.com/software-development/java/threads/401345

03hasnam:
Simply re-posting it is an insult to hfx642, NormR1, and stultuske who have already taken time to answer this the first time you posted it.
DaniWeb Member Rules include:
"Do not post the same question multiple times"

Duplicate thread
http://www.daniweb.com/software-development/java/threads/401345

03hasnam:
Simply re-posting it is an insult to hfx642, NormR1, and stultuske who have already taken time to answer this the first time you posted it.
DaniWeb Member Rules include:
"Do not post the same question multiple times"

ok sorry newbee here, delete thread if you can or il try.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.