Get Name of User Currently Logged In to the Computer in Java
Description
The following code shows how to get Name of User Currently Logged In to the Computer.
Example
/* w ww. ja v a2s. co m*/
public class Main {
public static void main(String[] args) {
String currentUser = System.getProperty("user.name");
System.out.println(currentUser);
}
}
The code above generates the following result.