That's a temporary file, that one is supposed to be unique named and is just for temporary use - normally less then an application's life cycle.
You want to hold some "LoginStatus". What does that mean? what is in there?
I would recommend to make a facade for that or to store the data in a property list.
Both will be destroyed when the application is ending, data must not be written to disc, so it's pretty safe.
But please tell us what you want to store.
Simple Code:
The application holds a Hashmap, which stores the current status, set as a enum to make it easy & safe for setting.
This is very basic, for more information I'd recommend to create an Object holding one employee's data in a facade.
import java.util.HashMap;
public class Application {
public enum STATUS {
IN, OUT
}
private HashMap<String, STATUS> oMap = new HashMap<String, STATUS>();
public Application(){
setStatus("Alex", STATUS.IN);
setStatus("John", STATUS.IN);
setStatus("Jack", STATUS.IN);
showStatus();
setStatus("Alex", STATUS.OUT);
showStatus();
}
private void showStatus() {
for (String strValue : oMap.keySet()) {
System.out.println("The Employee " + strValue + " is " + oMap.get(strValue));
}
System.out.println();
}
private void setStatus(String strName, STATUS oState){
oMap.put(strName, oState);
}
public static void main(String[] args) {
Application oApp = new Application();
}
}