Can someone help me to write a program that can read and write to a file and then store the user input in the file using the Property and ClassLoader classes.Also when another person uses the program it should tell you the last person to use the program.Thanks in advance

Show us what you have.

import java.util.*;
public class FileReadWrite{

    public static void main(String[] args) throws IOException{

     BufferedReader stdin = new BufferedReader(new InputStreamReader(;
      String name = " "; 

      FileWriter fw = new FileWriter("");//append the file content
      BufferedWriter bw = new BufferedWriter(fw);
      bw.write("Peter maingi"+"\n"); 

    //create property object
      Properties props = new Properties();

      InputStream inputStream = ClassLoader.getSystemResourceAsStream("");
      String myValue = props.getProperty("key");

      FileReader fr=new FileReader("");
      BufferedReader br = new BufferedReader(fr);

       System.out.println("Welcome,the name of the last person to use the program was:" + br.readLine());

        while ((name = br.readLine()) != null) { 
            System.out.println("Enter your Name");
            name = stdin.readLine();


Rather than having both properties and an extra line with a username, simply add a user=name property. Then all you have to do is load, setProperty (for each key to be changed), and store.

I appreciated for ur assistance.The program finnally did wonders.Kudos for ur gud work

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.